anjuta r4344 - in trunk: . plugins/class-inheritance plugins/symbol-db



Author: mcora
Date: Thu Oct 16 20:04:41 2008
New Revision: 4344
URL: http://svn.gnome.org/viewvc/anjuta?rev=4344&view=rev

Log:
	* plugins/class-inheritance/class-callbacks.c
	(on_toggled_menuitem_clicked), (on_member_menuitem_clicked),
	(on_nodedata_expanded_event):
	* plugins/class-inheritance/class-inherit.c
	(cls_inherit_nodestatus_destroy), (gtree_compare_func),
	(class_inheritance_create_agnode_key_name),
	(class_inheritance_get_symbol_from_agnode_key_name),
	(class_inheritance_show_dynamic_class_popup_menu),
	(cls_inherit_nodedata_destroy), (cls_inherit_add_node),
	(cls_inherit_add_edge), (cls_inherit_draw_expanded_node),
	(cls_inherit_draw_single_node), (cls_inherit_draw_graph),
	(class_inheritance_update_graph), (class_inheritance_gtree_clear),
	(class_inheritance_base_gui_init):
	* plugins/class-inheritance/class-inherit.h:
	* plugins/class-inheritance/plugin.c (project_root_removed),
	(deactivate_plugin):
	* plugins/class-inheritance/plugin.h:
	* plugins/symbol-db/symbol-db-engine-iterator-node.c
	(symbol_db_engine_iterator_node_new),
	(sdb_engine_iterator_node_instance_init),
	(sdb_engine_iterator_node_finalize),
	(symbol_db_engine_iterator_node_get_symbol_extra_string),
	(symbol_db_engine_iterator_node_set_prj_directory):
	* plugins/symbol-db/symbol-db-engine-iterator-node.h:
	* plugins/symbol-db/symbol-db-engine-iterator.c
	(symbol_db_engine_iterator_new), (isymbol_iter_first),
	(isymbol_iter_next), (isymbol_iter_previous), (isymbol_iter_last),
	(isymbol_iter_set_position):
	* plugins/symbol-db/symbol-db-engine-iterator.h:
	* plugins/symbol-db/symbol-db-engine.c
	(symbol_db_engine_get_class_parents_by_symbol_id),
	(symbol_db_engine_get_class_parents),
	(symbol_db_engine_get_global_members_filtered),
	(symbol_db_engine_get_scope_members_by_symbol_id_filtered),
	(symbol_db_engine_get_scope_members_by_symbol_id),
	(symbol_db_engine_get_scope_members),
	(symbol_db_engine_get_current_scope),
	(symbol_db_engine_get_file_symbols),
	(symbol_db_engine_get_symbol_info_by_id),
	(symbol_db_engine_find_symbol_by_name_pattern),
	(symbol_db_engine_find_symbol_by_name_pattern_filtered),
	(symbol_db_engine_get_files_for_project):
	* plugins/symbol-db/symbol-db-engine.h:
	fixed bug #544292 and adjusted some things on symbol-db iterators.


Modified:
   trunk/ChangeLog
   trunk/plugins/class-inheritance/class-callbacks.c
   trunk/plugins/class-inheritance/class-inherit.c
   trunk/plugins/class-inheritance/class-inherit.h
   trunk/plugins/class-inheritance/plugin.c
   trunk/plugins/class-inheritance/plugin.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.c
   trunk/plugins/symbol-db/symbol-db-engine-iterator.h
   trunk/plugins/symbol-db/symbol-db-engine.c
   trunk/plugins/symbol-db/symbol-db-engine.h
   trunk/plugins/symbol-db/symbol-db-view.c

Modified: trunk/plugins/class-inheritance/class-callbacks.c
==============================================================================
--- trunk/plugins/class-inheritance/class-callbacks.c	(original)
+++ trunk/plugins/class-inheritance/class-callbacks.c	Thu Oct 16 20:04:41 2008
@@ -17,6 +17,7 @@
  */
 
 #include <glib.h>
+#include <gio/gio.h>
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/interfaces/ianjuta-document-manager.h>
 #include <libanjuta/interfaces/ianjuta-symbol-manager.h>
@@ -58,31 +59,33 @@
 {
 	NodeData *node;
 	node = (NodeData*)data;
-	
-	if (node->name == NULL || g_str_equal (node->name, ""))
-		return;
 		
-	if (node->anchored) {
+	if (node->anchored) 
+	{
 		node->anchored = FALSE;
 		
 		/* remove the key from the hash table, if present */
-		if (g_hash_table_lookup (node->plugin->expansion_node_list, node->name)) {
-			g_hash_table_remove (node->plugin->expansion_node_list, node->name);
+		if (g_tree_lookup (node->plugin->expansion_node_list, 
+						   GINT_TO_POINTER (node->klass_id))) 
+		{
+			g_tree_remove (node->plugin->expansion_node_list, 
+						   GINT_TO_POINTER (node->klass_id));
 		}
 	}
-	else {
+	else 
+	{
 		NodeExpansionStatus *node_status;
 		node->anchored = TRUE;
 		
 		node_status = g_new0 (NodeExpansionStatus, 1);
-		node_status->name = g_strdup (node->name);
+		node_status->klass_id = node->klass_id;
 		/* set to half. This will display at least NODE_HALF_DISPLAY_ELEM_NUM.
 		 * User will decide whether to show all elements or not. */
 		node_status->expansion_status = NODE_HALF_EXPANDED;
 		
 		/* insert the class name to the hash_table */
-		g_hash_table_insert (node->plugin->expansion_node_list, 
-							g_strdup (node->name), 
+		g_tree_insert (node->plugin->expansion_node_list, 
+							GINT_TO_POINTER (node->klass_id), 
 							node_status);
 	}
 	
@@ -92,23 +95,31 @@
 void
 on_member_menuitem_clicked (GtkMenuItem *menuitem, gpointer data)
 {
-	NodeData *node;
-	GFile* file;
+	NodeData *node;	
+	const gchar *file;
 	gint line;
 	
 	node = (NodeData*)data;
-	file = g_object_get_data (G_OBJECT (menuitem), "__file");
-	line = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem), "__line"));
+	file = g_object_get_data (G_OBJECT (menuitem), "__filepath");
+	line = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menuitem), "__line"));	
+
+	DEBUG_PRINT ("got uri %s [%d]", file, line);
+	
 	if (file)
 	{
+		GFile* gfile;
+		gfile = g_file_new_for_path (file);
 		/* Goto uri line */
 		IAnjutaDocumentManager *dm;
 		dm = anjuta_shell_get_interface (ANJUTA_PLUGIN (node->plugin)->shell,
 										 IAnjutaDocumentManager, NULL);
 		if (dm)
 		{
-			ianjuta_document_manager_goto_file_line (dm, file, line, NULL);
+			ianjuta_document_manager_goto_file_line (dm, gfile, line, NULL);
 		}
+
+		if (gfile)
+			g_object_unref (gfile);
 	}
 }
 
@@ -128,35 +139,49 @@
 	case GDK_BUTTON_PRESS:		/* single click */
 		if (event->button.button == 1) {
 			NodeExpansionStatus *node_status;
-			if ( (node_status = (NodeExpansionStatus*)g_hash_table_lookup (plugin->expansion_node_list, 
-																				nodedata->name)) == NULL) {
+			if ( (node_status = 
+				  (NodeExpansionStatus*)g_tree_lookup (plugin->expansion_node_list, 
+												GINT_TO_POINTER (nodedata->klass_id))) 
+				== NULL) 
+			{
 				break;
 			}
-			else				
-				if (strcmp (nodedata->sub_item, NODE_SHOW_ALL_MEMBERS_STR) == 0) {
+			else if (strcmp (nodedata->sub_item, NODE_SHOW_ALL_MEMBERS_STR) == 0) 
+			{
 					node_status->expansion_status = NODE_FULL_EXPANDED;
 					class_inheritance_update_graph (plugin);
-				}
-			else
-				if (strcmp (nodedata->sub_item, NODE_SHOW_NORMAL_VIEW_STR) == 0) {
-					g_hash_table_remove (plugin->expansion_node_list, nodedata->name);
+			}			
+			else if (strcmp (nodedata->sub_item, NODE_SHOW_NORMAL_VIEW_STR) == 0) 
+			{
+					g_tree_remove (plugin->expansion_node_list, 
+								   GINT_TO_POINTER (nodedata->klass_id));
 					class_inheritance_update_graph (plugin);
-				}
-			else {		/* it's a class member. Take line && uri of definition 
-							 * and reach them */
-				GFile* file;
+			}
+			else 		/* it's a class member. Take line && uri of definition */
+			{			/* and reach them */
+				const gchar *file;
 				gint line;
 				
-				file = g_object_get_data (G_OBJECT (item), "__file");
-				line = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "__line"));
-				if (file) {
+				file = g_object_get_data (G_OBJECT (item), "__filepath");
+				line = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (item), "__line"));				
+								
+				if (file) 
+				{
+					GFile* gfile;
+					
+					gfile = g_file_new_for_path (file);
+					
 					/* Goto uri line */
 					IAnjutaDocumentManager *dm;
 					dm = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
 											 	IAnjutaDocumentManager, NULL);
-					if (dm) {
-						ianjuta_document_manager_goto_file_line (dm, file, line, NULL);
+					if (dm) 
+					{
+						ianjuta_document_manager_goto_file_line (dm, gfile, line, NULL);
 					}
+					
+					if (gfile)
+						g_object_unref (gfile);
 				}
 			}
 		}

Modified: trunk/plugins/class-inheritance/class-inherit.c
==============================================================================
--- trunk/plugins/class-inheritance/class-inherit.c	(original)
+++ trunk/plugins/class-inheritance/class-inherit.c	Thu Oct 16 20:04:41 2008
@@ -59,19 +59,72 @@
 
 static void
 cls_inherit_nodestatus_destroy (NodeExpansionStatus *node) {
-	if (node->name)
-		g_free (node->name);
-	
 	g_free (node);
 }
 
+static gint
+gtree_compare_func (gconstpointer a, gconstpointer b, gpointer user_data)
+{
+	return (gint)a - (gint)b;
+}
+
+gchar *
+class_inheritance_create_agnode_key_name (const IAnjutaSymbol* symbol)
+{
+	const gchar *node_sym_name;
+	gint node_sym_id;
+	gchar *graph_node_name;
+	
+	g_return_val_if_fail (symbol != NULL, NULL);
+	
+	
+	/* begin the key of a Agnode only a char, we should provide some hack
+	 * to make sure that each node can be different fom each other, even if it has
+	 * the same name as another node
+	 *
+	 * Let's concatenate the IAnjutaSymbol id with its name in such form:
+	 * 'id:name'.
+	 */
+	node_sym_name = ianjuta_symbol_get_name (IANJUTA_SYMBOL (symbol), NULL);
+	node_sym_id = ianjuta_symbol_get_id (IANJUTA_SYMBOL (symbol), NULL);
+	graph_node_name = g_strdup_printf ("%d:%s", node_sym_id, node_sym_name);
+
+	return graph_node_name;
+}
+
+IAnjutaSymbol *
+class_inheritance_get_symbol_from_agnode_key_name (AnjutaClassInheritance *plugin,
+												   const gchar *key)
+{
+	IAnjutaSymbol * symbol;
+	IAnjutaSymbolManager *sm;
+	
+	gchar **res = g_strsplit (key, ":", -1);
+	gint sym_id = atoi (res[0]);
+	
+
+	g_return_val_if_fail (plugin != NULL, NULL);
+
+	sm = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
+									 IAnjutaSymbolManager, NULL);
+	
+	symbol = ianjuta_symbol_manager_get_symbol_by_id (sm,
+													sym_id,
+													IANJUTA_SYMBOL_FIELD_SIMPLE,
+													NULL);	
+	
+	g_strfreev (res);
+	
+	return symbol;
+}
+
 void
 class_inheritance_show_dynamic_class_popup_menu (GdkEvent *event,
 										   NodeData* nodedata)
 {
 	GtkWidget *item, *image;
 	GtkWidget *checkitem, *separator;
-	
+		
 	/* Destroy the old menu before creating a new one */
 	if (nodedata->menu)
 	{
@@ -79,49 +132,35 @@
 	}
 		
 	nodedata->menu = gtk_menu_new();
-	if (nodedata->name && strlen (nodedata->name))
+	if (nodedata->klass_id > 0)
 	{
 		IAnjutaSymbolManager *sm;
-		IAnjutaIterable *iter_searched;
 		IAnjutaIterable *iter;
 		IAnjutaSymbol *symbol_searched;
 		sm = anjuta_shell_get_interface (ANJUTA_PLUGIN (nodedata->plugin)->shell,
 										 IAnjutaSymbolManager, NULL);
 		if (sm == NULL)
 			return;
-		
-		/* we cannot pass a simple 'name' to get_members () interface. That
-		 * wouldn't be enought to identify uniquely the symbol itself.
-		 * Think for example at two namespaces with two classes with the same
-		 * name... Anyway the situation here wasn't better even before. The problem
-		 * persists and to be solved it's needed a re-engineering of class-inherit.
-		 */
-		iter_searched = ianjuta_symbol_manager_search (sm, IANJUTA_SYMBOL_TYPE_CLASS,
-													   TRUE,
-													   IANJUTA_SYMBOL_FIELD_SIMPLE,
-													   nodedata->name,
-													   FALSE,
-													   TRUE,
-													   FALSE,
-													   -1,
-													   -1,
-													   NULL);
-		
-		if (iter_searched == NULL)
-			return;
-		
-		symbol_searched = IANJUTA_SYMBOL (iter_searched);
+
+		symbol_searched = ianjuta_symbol_manager_get_symbol_by_id (sm, 
+												 nodedata->klass_id,
+												 IANJUTA_SYMBOL_FIELD_SIMPLE,
+												 NULL);
+												 
 		iter = ianjuta_symbol_manager_get_members (sm, symbol_searched,
-												   IANJUTA_SYMBOL_FIELD_SIMPLE,
+												   IANJUTA_SYMBOL_FIELD_SIMPLE |
+												   IANJUTA_SYMBOL_FIELD_TYPE |
+												   IANJUTA_SYMBOL_FIELD_ACCESS |
+												   IANJUTA_SYMBOL_FIELD_FILE_PATH,
 												   FALSE, NULL);
 		if (iter && ianjuta_iterable_get_length (iter, NULL) > 0)
-		{
-			IAnjutaSymbol *symbol = IANJUTA_SYMBOL (iter);
+		{	
 			do
 			{
 				const gchar *name, *file;
 				const GdkPixbuf *pixbuf;
-				gint line;
+				gint line;		
+				IAnjutaSymbol *symbol = IANJUTA_SYMBOL (iter);
 				
 				name = ianjuta_symbol_get_name (symbol, NULL);
 				pixbuf = ianjuta_symbol_get_icon (symbol, NULL);
@@ -136,7 +175,7 @@
 				
 				if (file)
 				{
-					g_object_set_data_full (G_OBJECT (item), "__file_path",
+					g_object_set_data_full (G_OBJECT (item), "__filepath",
 											g_strdup (file), g_free);
 					g_object_set_data (G_OBJECT (item), "__line",
 									   GINT_TO_POINTER (line));
@@ -151,12 +190,7 @@
 		if (iter)  
 		{
 			g_object_unref (iter);
-		}
-		if (iter_searched)
-		{
-			g_object_unref (iter_searched);
-		}
-			
+		}			
 	}
 	
 	
@@ -220,12 +254,6 @@
 static void
 cls_inherit_nodedata_destroy (NodeData *node_data)
 {
-	if (node_data->name)
-	{
-		g_free (node_data->name);
-		node_data->name = NULL;
-	}
-	
 	if (node_data->canvas_item)
 	{
 		gtk_object_destroy (GTK_OBJECT (node_data->canvas_item));
@@ -276,25 +304,41 @@
  * that we can build the label of the node with the class-data.
  */
 static gboolean
-cls_inherit_add_node (AnjutaClassInheritance *plugin, const gchar* node_name)
+cls_inherit_add_node (AnjutaClassInheritance *plugin, const IAnjutaSymbol *node_sym)
 {
-	Agnode_t *node;
+	Agnode_t *graph_node;
 	Agsym_t *sym;
 	NodeExpansionStatus *node_status;
+	const gchar *node_sym_name;
+	gint node_sym_id;
+	gchar *graph_node_name;
+	
 	
 	/* if graph isn't initialized, init it */
 	if (!plugin->graph)
 		cls_inherit_graph_init (plugin, _(DEFAULT_GRAPH_NAME));
 	
+	node_sym_name = ianjuta_symbol_get_name (IANJUTA_SYMBOL (node_sym), NULL);
+	node_sym_id = ianjuta_symbol_get_id (IANJUTA_SYMBOL (node_sym), NULL);
+
+	/* get an unique char key for an agnode */
+	graph_node_name = class_inheritance_create_agnode_key_name (node_sym);
+		
 	/* let's add the node to the graph */
-	if ((node = agnode (plugin->graph, (gchar*)node_name)) == NULL)
+	if ((graph_node = agnode (plugin->graph, 
+							  graph_node_name)) == NULL)
+	{
+		g_free (graph_node_name);
 		return FALSE;
+	}
+	g_free (graph_node_name);
 	
-	/* check for the node in the hash_table */
+	/* check for the node in the gtree */
 	if ( (node_status = 
-				(NodeExpansionStatus*)g_hash_table_lookup 
-				(plugin->expansion_node_list, node_name)) != NULL && 
-				node_status->expansion_status != NODE_NOT_EXPANDED) {
+				(NodeExpansionStatus*)g_tree_lookup (plugin->expansion_node_list, 
+					GINT_TO_POINTER (node_sym_id))) != NULL && 
+				node_status->expansion_status != NODE_NOT_EXPANDED) 
+	{
 		GString *label;
 		gint max_label_items = 0;
 		gint real_items_length = 0;
@@ -302,51 +346,37 @@
 
 		if (!(sym = agfindattr(plugin->graph->proto->n, "shape")))
 			sym = agnodeattr(plugin->graph, "shape", "");
-		agxset(node, sym->index, "record");
+		agxset (graph_node, sym->index, "record");
 		
 		if (!(sym = agfindattr(plugin->graph->proto->n, "label")))
 			sym = agnodeattr(plugin->graph, "label", "");
 		
 		label = g_string_new ("");
-		g_string_printf (label, "{%s", node_name);
+		g_string_printf (label, "{%s", node_sym_name);
 		
 		sm = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
 										 IAnjutaSymbolManager, NULL);
 		if (sm)
 		{
 			IAnjutaIterable *iter;
-			IAnjutaIterable *iter_searched;
-			IAnjutaSymbol *symbol_searched;
-			iter_searched = ianjuta_symbol_manager_search (sm, IANJUTA_SYMBOL_TYPE_CLASS,
-													   TRUE,
-													   IANJUTA_SYMBOL_FIELD_SIMPLE,
-													   node_name,
-													   FALSE,
-													   TRUE,
-													   FALSE,
-													   -1,
-													   -1,
-													   NULL);
-		
-			if (iter_searched == NULL) {
-				g_string_free (label, TRUE);
-				return FALSE;
-			}
-		
-			symbol_searched = IANJUTA_SYMBOL (iter_searched);
 			
-			iter = ianjuta_symbol_manager_get_members (sm, symbol_searched,
-													   IANJUTA_SYMBOL_FIELD_SIMPLE,
-													   FALSE, NULL);
+			/* get members from the passed symbol node */
+			iter = ianjuta_symbol_manager_get_members (sm, node_sym,
+													IANJUTA_SYMBOL_FIELD_SIMPLE|
+												   	IANJUTA_SYMBOL_FIELD_TYPE |
+												   	IANJUTA_SYMBOL_FIELD_ACCESS,													   
+													FALSE, NULL);
 			real_items_length = ianjuta_iterable_get_length (iter, NULL);
 
 			/* set the max number of items to draw */
 			if (real_items_length <= NODE_HALF_DISPLAY_ELEM_NUM || 
-						node_status->expansion_status == NODE_FULL_EXPANDED) {
+						node_status->expansion_status == NODE_FULL_EXPANDED) 
+			{
 				max_label_items = real_items_length;
 				node_status->expansion_status = NODE_FULL_EXPANDED;
 			}
-			else {
+			else 
+			{
 				max_label_items = NODE_HALF_DISPLAY_ELEM_NUM;
 			}
 
@@ -365,10 +395,7 @@
 				} while (ianjuta_iterable_next (iter, NULL) && i < max_label_items);
 			}
 			if (iter)
-				g_object_unref (iter);
-			
-			if (iter_searched)
-				g_object_unref (iter_searched);
+				g_object_unref (iter);			
 		}
 		
 		if (node_status->expansion_status == NODE_HALF_EXPANDED &&
@@ -377,38 +404,38 @@
 		}
 		
 		g_string_append_printf (label, "|%s }", NODE_SHOW_NORMAL_VIEW_STR);
-		agxset(node, sym->index, label->str);
+		agxset(graph_node, sym->index, label->str);
 		
 		g_string_free (label, TRUE);
 	}
 	else {	/* the node isn't in an expansion status. 
-				 * Go on setting a regular one */
+			 * Go on setting a regular one */
 
 		/* Set an attribute - in this case one that affects the visible rendering */
 		if (!(sym = agfindattr(plugin->graph->proto->n, "shape")))
 			sym = agnodeattr(plugin->graph, "shape", "");
-		agxset(node, sym->index, "box");
+		agxset(graph_node, sym->index, "box");
 		
 		if (!(sym = agfindattr(plugin->graph->proto->n, "label")))
 			sym = agnodeattr(plugin->graph, "label", "");
-		agxset(node, sym->index, node->name);		
+		agxset(graph_node, sym->index, graph_node->name);		
 	}
 
 	/* set the font */
 	if (!(sym = agfindattr(plugin->graph->proto->n, "fontname")))
 		sym = agnodeattr(plugin->graph, "fontname", "");
-	agxset(node, sym->index, "Courier new");
+	agxset(graph_node, sym->index, "Courier new");
 
 	/* set the font-size */	
 	if (!(sym = agfindattr(plugin->graph->proto->n, "fontsize")))
 		sym = agnodeattr(plugin->graph, "fontsize", "");
 	/* hack: set canvas_text_fontsize + 4 points or text would oversize the block */
 	/* add some more points for icons 16x16 space */
-	agxset(node, sym->index, "17");
+	agxset(graph_node, sym->index, "17");
 
 	if (!(sym = agfindattr(plugin->graph->proto->n, "ratio")))
 		sym = agnodeattr(plugin->graph, "ratio", "");
-	agxset(node, sym->index, "expand");	
+	agxset(graph_node, sym->index, "expand");	
 
 	return TRUE;
 }
@@ -418,11 +445,12 @@
  */
 static gboolean
 cls_inherit_add_edge (AnjutaClassInheritance *plugin,
-					  const gchar* node_from,
-					  const gchar* node_to)
+					  const IAnjutaSymbol *node_sym_from,
+					  const IAnjutaSymbol *node_sym_to)
 {
 	Agedge_t *edge;
 	Agnode_t *n_from, *n_to;
+	gchar *from_key, *to_key;
 
 	/* if we hadn't initialized out graph we return FALSE. Edges require
 	 * two nodes
@@ -430,12 +458,23 @@
 	if (!plugin->graph)
 		return FALSE;
 	
-	if ((n_from = agfindnode (plugin->graph, (gchar*)node_from)) == NULL)
-		return FALSE;
+	from_key = class_inheritance_create_agnode_key_name (node_sym_from);
 	
-	if ((n_to = agfindnode (plugin->graph, (gchar*)node_to)) == NULL)
+	if ((n_from = agfindnode (plugin->graph, from_key)) == NULL)
+	{	
+		g_free (from_key);
 		return FALSE;
+	}
+	g_free (from_key);
 	
+	to_key = class_inheritance_create_agnode_key_name (node_sym_to);
+	if ((n_to = agfindnode (plugin->graph, to_key)) == NULL)
+	{
+		g_free (to_key);
+		return FALSE;
+	}
+	g_free (to_key);
+		
 	if ((edge = agedge (plugin->graph, n_from, n_to)) == NULL)
 		return FALSE;
 	
@@ -444,72 +483,75 @@
 
 
 /*----------------------------------------------------------------------------
- * Draw an expanded node. Function simplify cls_inherit_draw_graph().
+ * Draw an expanded node. Function which simplifies cls_inherit_draw_graph().
  */
 static void
-cls_inherit_draw_expanded_node (AnjutaClassInheritance *plugin, Agnode_t *node, 
-					point* node_pos, gdouble node_width, gdouble node_height) {
+cls_inherit_draw_expanded_node (AnjutaClassInheritance *plugin, Agnode_t *graph_node, 
+					point* node_pos, gdouble node_width, gdouble node_height) 
+{
 	GnomeCanvasItem *item;
-	NodeData *node_data;
 	NodeExpansionStatus *node_status;
+	NodeData *node_data;
 	gint expansion_status;
 	gint i, j;
 	IAnjutaSymbolManager *sm;
 	IAnjutaIterable *symbol_iter = NULL;
+	IAnjutaSymbol *node_sym;
+	gint node_sym_id;
 	
 	sm = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
 										 IAnjutaSymbolManager, NULL);
-	if (!sm) {
-		return;
-	}
-						
-	IAnjutaIterable *iter_searched;
-	IAnjutaSymbol *symbol_searched;
-	iter_searched = ianjuta_symbol_manager_search (sm, IANJUTA_SYMBOL_TYPE_CLASS,
-												   TRUE,
-												   IANJUTA_SYMBOL_FIELD_SIMPLE,
-												   node->name,
-												   FALSE,
-												   TRUE,
-												   FALSE,
-												   -1,
-												   -1,
-												   NULL);
-		
-	if (iter_searched == NULL) {
-		return;
-	}
-		
-	symbol_searched = IANJUTA_SYMBOL (iter_searched);
-						
-	symbol_iter = ianjuta_symbol_manager_get_members (sm, symbol_searched,
-													  IANJUTA_SYMBOL_FIELD_SIMPLE,
-													  FALSE, NULL);
+	if (!sm) 
+		return;	
 						
+	node_sym = class_inheritance_get_symbol_from_agnode_key_name (plugin,
+												graph_node->name);		
+	
+	node_sym_id = ianjuta_symbol_get_id (node_sym, NULL);
+	symbol_iter = ianjuta_symbol_manager_get_members (sm, node_sym,
+													IANJUTA_SYMBOL_FIELD_SIMPLE |
+												   	IANJUTA_SYMBOL_FIELD_TYPE |
+												   	IANJUTA_SYMBOL_FIELD_ACCESS |
+													IANJUTA_SYMBOL_FIELD_FILE_PATH,
+													FALSE, NULL);
+
+	g_object_unref (node_sym);
+	
 	/* we need to know which label to draw, wether only the "show all" or just 
 	 * the "normal view" */
 	if ( (node_status = 
-				(NodeExpansionStatus*)g_hash_table_lookup 
-				(plugin->expansion_node_list, node->name)) == NULL) {
+				(NodeExpansionStatus*)g_tree_lookup 
+				(plugin->expansion_node_list, GINT_TO_POINTER (node_sym_id))) == NULL) 
+	{
 		expansion_status = NODE_NOT_EXPANDED;
 	}
 	else
 		expansion_status = node_status->expansion_status;
 
-	for (i=0; i < NODE_NUM_FIELDS (node); i++ ) {
-		for (j=0; j < NODE_NTH_FIELD (node,i)->n_flds; j++ ) {
+	for (i=0; i < NODE_NUM_FIELDS (graph_node); i++ ) 
+	{
+		for (j=0; j < NODE_NTH_FIELD (graph_node, i)->n_flds; j++ ) 
+		{
+			IAnjutaSymbol *symbol;
+			gint symbol_id;
 			gint y1, y2;			
-			y1 = NODE_LOWER_LEFT(node,i,j).y;
-			y2 = NODE_UPPER_RIGHT(node,i,j).y;
+			y1 = NODE_LOWER_LEFT (graph_node, i, j).y;
+			y2 = NODE_UPPER_RIGHT(graph_node, i, j).y;
 
 			node_data = g_new0 (NodeData, 1);
+			
+			symbol = class_inheritance_get_symbol_from_agnode_key_name (plugin, 
+															graph_node->name);
+			
+			symbol_id = ianjuta_symbol_get_id (symbol, NULL);
+			g_object_unref (symbol);
 
 			/* set the plugin reference */
 			node_data->plugin = plugin;
 			node_data->anchored = TRUE;
-			node_data->name = g_strdup (node->name);
+			node_data->klass_id = symbol_id;
 
-			node_data->sub_item = g_strdup (NODE_NTH_TEXT (node,i,j));
+			node_data->sub_item = g_strdup (NODE_NTH_TEXT (graph_node,i,j));
 			
 			node_data->canvas_item =
 			gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (plugin->canvas)),
@@ -540,7 +582,7 @@
 			item = gnome_canvas_item_new (gnome_canvas_root
 										  (GNOME_CANVAS (plugin->canvas)),
 										  gnome_canvas_text_get_type (),
-										  "text", NODE_NTH_TEXT (node,i,j),
+										  "text", NODE_NTH_TEXT (graph_node, i, j),
 										  "font", NODE_FONT_DEFAULT,
 										  "justification", GTK_JUSTIFY_CENTER,
 										  "style", PANGO_STYLE_ITALIC,
@@ -556,7 +598,8 @@
 									  	  NULL);
 			plugin->drawable_list = g_list_prepend (plugin->drawable_list, item);
 			
-			if (j == 0) {		/* the Class' name case: make it bold */
+			if (j == 0) 		/* the Class' name case: make it bold */
+			{				
 				gnome_canvas_item_set (item, 
 							"weight", PANGO_WEIGHT_BOLD, 
 							"style", PANGO_STYLE_NORMAL,
@@ -564,8 +607,10 @@
 				continue;
 			}
 			else					/* we need to draw the last 2 elements differently */
+			{
 				if (expansion_status == NODE_HALF_EXPANDED && 
-					j > (NODE_NTH_FIELD (node,i)->n_flds -3)) {
+					j > (NODE_NTH_FIELD (graph_node, i)->n_flds -3)) 
+				{
 					gnome_canvas_item_set (item, 
 								"weight", PANGO_WEIGHT_HEAVY, 
 								"style", PANGO_STYLE_NORMAL,
@@ -573,23 +618,29 @@
 					continue;
 				}
 				else				/* only the last one. Usually "Normal view" */
+				{
 					if (expansion_status == NODE_FULL_EXPANDED && 
-						j > (NODE_NTH_FIELD (node,i)->n_flds -2)) {
+						j > (NODE_NTH_FIELD (graph_node, i)->n_flds -2)) 
+					{
 						gnome_canvas_item_set (item, 
 									"weight", PANGO_WEIGHT_HEAVY,
 									"style", PANGO_STYLE_NORMAL,
 									NULL);
 						continue;
 					}
-					
+				}
+			}
+			
 			/* go on with the icons */
-			if (symbol_iter && ianjuta_iterable_get_length (symbol_iter, NULL) > 0) {
+			if (symbol_iter && ianjuta_iterable_get_length (symbol_iter, NULL) > 0) 
+			{
 				const GdkPixbuf *pixbuf;
-				GFile* file;
+				GFile* gfile;
+				gchar *file;
 				gint line;
 				IAnjutaSymbol *symbol = IANJUTA_SYMBOL (symbol_iter);
 
-				file = ianjuta_symbol_get_file (symbol, NULL);
+				gfile = ianjuta_symbol_get_file (symbol, NULL);
 				line = ianjuta_symbol_get_line (symbol, NULL);
 				pixbuf = ianjuta_symbol_get_icon (symbol, NULL);
 				
@@ -607,24 +658,26 @@
 
 				/* set now the object properties on node_data. We still have a 
 				 * reference to it so we can access its canvas_item */
-				if (file) {
-					g_object_set_data_full (G_OBJECT (node_data->canvas_item), "__file",
+				if (gfile) 
+				{
+					file = g_file_get_path (gfile);
+					
+					g_object_set_data_full (G_OBJECT (node_data->canvas_item), "__filepath",
 											file, g_object_unref);
 					g_object_set_data (G_OBJECT (node_data->canvas_item), "__line",
 									   GINT_TO_POINTER (line));
+					
+					/* no need to free 'file'. It'll be freed when object'll be unreffed */
 				}
 			}
 			plugin->drawable_list = g_list_prepend (plugin->drawable_list, item);
 			ianjuta_iterable_next (symbol_iter, NULL);
-		}
+		} /*- for */
 	}
 	
 	if (symbol_iter)
 		g_object_unref (symbol_iter);
 	
-	if (iter_searched)
-		g_object_unref (iter_searched);
-						
 	/* make the outline bounds */
 	item =
 	gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (plugin->canvas)),
@@ -646,20 +699,28 @@
 }
 
 static void
-cls_inherit_draw_single_node (AnjutaClassInheritance *plugin, Agnode_t *node, 
-					point *node_pos, gdouble node_width, gdouble node_height) {
+cls_inherit_draw_single_node (AnjutaClassInheritance *plugin, Agnode_t *graph_node, 
+					point *node_pos, gdouble node_width, gdouble node_height) 
+{
 	NodeData *node_data;
 	GnomeCanvasItem *item;
 	gdouble text_width_value;
+	IAnjutaSymbol *node_sym;
+	const gchar* node_sym_name;
 
-	node_data = g_new0 (NodeData, 1);
-		
+	node_sym = class_inheritance_get_symbol_from_agnode_key_name (plugin,
+															graph_node->name);
+	node_sym_name = ianjuta_symbol_get_name (node_sym, NULL);
+	node_data = g_new0 (NodeData, 1);		
+						
 	/* set the plugin reference */
 	node_data->plugin = plugin;
 	node_data->anchored = FALSE;
-	node_data->name = g_strdup (node->name);
+	node_data->klass_id = ianjuta_symbol_get_id (IANJUTA_SYMBOL (node_sym), NULL);
 	node_data->sub_item = NULL;
 		
+	g_object_unref (node_sym);
+	
 	node_data->canvas_item =
 	gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (plugin->canvas)),
 						   gnome_canvas_rect_get_type (),
@@ -688,7 +749,7 @@
 	item = gnome_canvas_item_new (gnome_canvas_root
 								  (GNOME_CANVAS (plugin->canvas)),
 								  gnome_canvas_text_get_type (),
-								  "text", node->name,
+								  "text", node_sym_name,
 								  "font", NODE_FONT_DEFAULT,
 								  "justification", GTK_JUSTIFY_CENTER,
 								  "anchor", GTK_ANCHOR_CENTER,
@@ -721,7 +782,7 @@
 	gint num_nodes;
 	gdouble max_canvas_size_x, max_canvas_size_y;
 	GnomeCanvasItem *item;
-	Agnode_t *node;
+	Agnode_t *graph_node;
 	Agedge_t *edge;
 	
 	if (plugin->graph == NULL)
@@ -733,7 +794,6 @@
 	
 	/* compiles nodes/edges informations, such as positions, coordinates etc */
 	gvLayout (plugin->gvc, plugin->graph, "dot");
-	//dot_layout (plugin->graph);
 	
 	/* set the size of the canvas. We need this to set the scrolling.. */
 	max_canvas_size_x = max_canvas_size_y = CANVAS_MIN_SIZE;
@@ -749,27 +809,30 @@
 	}
 		
 	/* first of all draw the nodes */
-	for (node = agfstnode (plugin->graph); node;
-		 node = agnxtnode (plugin->graph, node))
+	for (graph_node = agfstnode (plugin->graph); graph_node; 
+		 graph_node = agnxtnode (plugin->graph, graph_node))
 	{
 		gdouble node_width;
 		gdouble node_height;
 		point node_pos;
 		
 		/* get some infos from the node */
-		node_pos = ND_coord_i(node);
-		node_width = ND_width (node);
-		node_height = ND_height (node);
+		node_pos = ND_coord_i(graph_node);
+		node_width = ND_width (graph_node);
+		node_height = ND_height (graph_node);
 
-		if (strcmp ("record", ND_shape (node)->name) == 0 ) {
-			cls_inherit_draw_expanded_node (plugin, node, &node_pos, node_width, node_height);
+		if (strcmp ("record", ND_shape (graph_node)->name) == 0 ) 
+		{
+			cls_inherit_draw_expanded_node (plugin, graph_node, &node_pos, node_width, 
+											node_height);
 		}
 		else			/* it's a normal single node */
-			cls_inherit_draw_single_node (plugin, node, &node_pos, node_width, node_height);
+			cls_inherit_draw_single_node (plugin, graph_node, &node_pos, node_width, 
+										  node_height);
 
 		/* --- edges --- */
-		for (edge = agfstedge (plugin->graph, node); edge;
-			 edge = agnxtedge (plugin->graph, edge, node))
+		for (edge = agfstedge (plugin->graph, graph_node); edge;
+			 edge = agnxtedge (plugin->graph, edge, graph_node))
 		{
 			GnomeCanvasPathDef *path_def;
  			gint i;
@@ -854,7 +917,7 @@
 			}
 			
 			/* draw the path_def */
-         item = gnome_canvas_item_new (gnome_canvas_root
+         	item = gnome_canvas_item_new (gnome_canvas_root
 									   (GNOME_CANVAS (plugin->canvas)), 
 									   gnome_canvas_bpath_get_type(),
 									   "bpath", path_def,
@@ -892,8 +955,9 @@
 	IAnjutaSymbolManager *sm;
 	IAnjutaIterable *iter;
 	IAnjutaSymbol *symbol;
-	GList *classes, *node;
-	GHashTable *class_parents;
+	GList *node;
+	GTree *klass_parents;
+	GList *klasses_list;
 
 	g_return_if_fail (plugin != NULL);
 
@@ -904,20 +968,23 @@
 									 IAnjutaSymbolManager, NULL);
 	if (!sm)
 		return;
-	
+
+	/* Get all classes */	
 	iter = ianjuta_symbol_manager_search (sm, IANJUTA_SYMBOL_TYPE_CLASS, 
 										  TRUE,
 										  IANJUTA_SYMBOL_FIELD_SIMPLE,
-										  NULL, FALSE, TRUE, FALSE, -1, -1, NULL);
+										  NULL, TRUE, TRUE, FALSE, -1, -1, NULL);
 	if (!iter)
 	{
 		DEBUG_PRINT ("class_inheritance_update_graph (): search returned no items.");
 		return;
 	}
 	
+	/*
 	DEBUG_PRINT ("Number of classes found = %d",
 				 ianjuta_iterable_get_length (iter, NULL));	
-/*	
+
+
 	do {
 		const gchar *class_name;
 		symbol = IANJUTA_SYMBOL (iter);
@@ -925,7 +992,8 @@
 		DEBUG_PRINT ("=======> %s", class_name);
 	}
 	while (ianjuta_iterable_next (iter, NULL) == TRUE);
-*/	
+	*/	
+	
 	ianjuta_iterable_first (iter, NULL);
 	if (ianjuta_iterable_get_length (iter, NULL) <= 0)
 	{
@@ -933,75 +1001,95 @@
 		return;
 	}
 	
-	/* Get all classes */
-	classes = NULL;
-	class_parents = g_hash_table_new_full (g_str_hash, g_str_equal,
-										   g_free, g_object_unref);
-	do {
-		const gchar *class_name, *old_parents;
-		IAnjutaIterable *parents;
+	/* initialize the glist and the gtree where to store the klass_ids */
+	klasses_list = NULL;
+	klass_parents = g_tree_new_full ((GCompareDataFunc)&gtree_compare_func, 
+										 NULL,
+										 NULL,
+										 g_object_unref);
 
+	do 
+	{
+		gint klass_id;
+		IAnjutaIterable *parents;
+     
+		/* a symbol representing a class */
 		symbol = IANJUTA_SYMBOL (iter);
-		
+
 		/* get parents of the current class */
 		parents = ianjuta_symbol_manager_get_class_parents (sm, symbol, 
 															IANJUTA_SYMBOL_FIELD_SIMPLE, 
 															NULL);
 
+		/* if no parents are found then continue */
 		if (parents == NULL || ianjuta_iterable_get_length (parents, NULL) <= 0)
 		{
-			DEBUG_PRINT ("continuing 1...");
+			/*DEBUG_PRINT ("ClassInheritance: no parents found for class %s",
+						 ianjuta_symbol_get_name (symbol, NULL));*/
 			continue;
 		}
-		
-		class_name = ianjuta_symbol_get_name (symbol, NULL);
-		
-		if ((old_parents = g_hash_table_lookup (class_parents, class_name)))
+
+		if ((klass_id = ianjuta_symbol_get_id (symbol, NULL)) <= 0)
 		{
-			/* we already have a class inserted with that name */
-			DEBUG_PRINT ("continuing 2...");
+			/*DEBUG_PRINT ("ClassInheritance: klass_id cannot be <= 0");*/
 			continue;
 		}
+
+		if (g_tree_lookup (klass_parents, GINT_TO_POINTER (klass_id)) != NULL)
+		{
+			/* we already have a class inserted with that name */
+			continue;
+		}	
 		
-		DEBUG_PRINT ("parsed %s", class_name);
-		/* insert into the hash table a class name together with the associated parents */
-		g_hash_table_insert (class_parents, g_strdup (class_name), parents);
-		classes = g_list_prepend (classes, g_strdup (class_name));
+		/* insert into the gtree a class name id together with the associated parents */
+		g_tree_insert (klass_parents, GINT_TO_POINTER (klass_id), parents);
+
+		klasses_list = g_list_prepend (klasses_list, GINT_TO_POINTER (klass_id));
+
 	} while (ianjuta_iterable_next (iter, NULL) == TRUE);
-	
-	classes = g_list_reverse (classes);
-	
-	/* we don't need the iter anymore */
-	g_object_unref (iter);
-	
+
+	klasses_list = g_list_reverse (klasses_list);
+
+	/* we don't need the classes iter anymore */
+	if (iter != NULL)
+		g_object_unref (iter);
+	else
+		return;
+
 	/* For all classes get their parents */
-	node = classes;
+	node = klasses_list;
 	while (node)
 	{
-		const gchar *class_name;
+		gint klass_id;
 		IAnjutaIterable *parents;
-				
-		class_name = node->data;
-		parents = g_hash_table_lookup (class_parents, class_name);
+		IAnjutaSymbol *klass_symbol;
+
+		klass_id = GPOINTER_TO_INT (node->data);
+		parents = g_tree_lookup (klass_parents, GINT_TO_POINTER (klass_id));
+		klass_symbol = ianjuta_symbol_manager_get_symbol_by_id (sm,
+													klass_id,
+													IANJUTA_SYMBOL_FIELD_SIMPLE,
+													NULL);
 		
-		do {
-			IAnjutaSymbol *symbol;
-			symbol = IANJUTA_SYMBOL (parents);
-			const gchar *parent_name;
-			
-			parent_name = ianjuta_symbol_get_name (symbol, NULL);
+		do 
+		{
+			IAnjutaSymbol *parent_symbol;
+			parent_symbol = IANJUTA_SYMBOL (parents);
 			
-			cls_inherit_add_node (plugin, class_name);
-			cls_inherit_add_node (plugin, parent_name);
-			cls_inherit_add_edge (plugin, parent_name, class_name);
+			cls_inherit_add_node (plugin, klass_symbol);
+			cls_inherit_add_node (plugin, parent_symbol);
+			cls_inherit_add_edge (plugin, parent_symbol, klass_symbol);			
 		} while (ianjuta_iterable_next (parents, NULL) == TRUE);
 
+		/* we don't need it anymore */
+		g_object_unref (klass_symbol);
+		
 		/* parse next deriver class in the glist */
 		node = g_list_next (node);
 	}
-	g_list_foreach (classes, (GFunc)g_free, NULL);
-	g_list_free (classes);
-	g_hash_table_destroy (class_parents);
+
+	g_list_free (klasses_list);
+	g_tree_destroy (klass_parents);
 	cls_inherit_draw_graph (plugin);
 }
 
@@ -1022,18 +1110,19 @@
 };
 
 void 
-class_inheritance_hash_table_clear (AnjutaClassInheritance *plugin) {
+class_inheritance_gtree_clear (AnjutaClassInheritance *plugin) {
 	
 	if (plugin->expansion_node_list == NULL)
 		return;
 	
 	/* destroy the nodestatus hash table */
-	g_hash_table_destroy (plugin->expansion_node_list);
+	g_tree_destroy (plugin->expansion_node_list);
 	
 	/* reinitialize the table */
-	plugin->expansion_node_list = g_hash_table_new_full (g_str_hash, 
-												g_str_equal, g_free, 
-												(GDestroyNotify)cls_inherit_nodestatus_destroy);	
+	plugin->expansion_node_list = g_tree_new_full ((GCompareDataFunc)&gtree_compare_func, 
+								NULL,
+								NULL, 
+								(GDestroyNotify)cls_inherit_nodestatus_destroy);	
 }
 
 void
@@ -1043,8 +1132,8 @@
 
 	s_window = gtk_scrolled_window_new (NULL, NULL);
 	plugin->canvas = gnome_canvas_new_aa ();
-	//gtk_widget_modify_bg (plugin->canvas, GTK_STATE_NORMAL,
-	//					  &plugin->canvas->style->base[GTK_STATE_NORMAL]);
+	/*gtk_widget_modify_bg (plugin->canvas, GTK_STATE_NORMAL,
+						  &plugin->canvas->style->base[GTK_STATE_NORMAL]);*/
 	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (s_window),
 									GTK_POLICY_AUTOMATIC, 
 									GTK_POLICY_AUTOMATIC);
@@ -1079,9 +1168,11 @@
 	plugin->drawable_list = NULL;
 	plugin->node_list = NULL;
 	
-	plugin->expansion_node_list = g_hash_table_new_full (g_str_hash, 
-												g_str_equal, g_free, 
-												(GDestroyNotify)cls_inherit_nodestatus_destroy);
+	plugin->expansion_node_list = g_tree_new_full ((GCompareDataFunc)&gtree_compare_func, 
+										 NULL,
+										 NULL,
+										 (GDestroyNotify)cls_inherit_nodestatus_destroy);
+											
 
 	/* menu create */
 	plugin->menu = gtk_menu_new ();

Modified: trunk/plugins/class-inheritance/class-inherit.h
==============================================================================
--- trunk/plugins/class-inheritance/class-inherit.h	(original)
+++ trunk/plugins/class-inheritance/class-inherit.h	Thu Oct 16 20:04:41 2008
@@ -20,6 +20,8 @@
 #ifndef _CLASS_INHERIT_H
 #define _CLASS_INHERIT_H
 
+#include <libanjuta/interfaces/ianjuta-symbol-manager.h>
+
 #include "plugin.h"
 
 G_BEGIN_DECLS
@@ -29,20 +31,25 @@
 #define NODE_SHOW_ALL_MEMBERS_STR			N_("Show all members...")
 #define NODE_SHOW_NORMAL_VIEW_STR			N_("Normal view")
 
+
+
+
 typedef struct _NodeData {
-	GnomeCanvasItem *canvas_item;  /* item itself */
-	gchar *name;                   /* the name of the class */
-	gchar *sub_item;					 /* case of an expanded node */
-	gboolean anchored;             /* should it be anchored [e.g. paint all the 
-	                                * data to the graph?]
-	                                */
+	GnomeCanvasItem *canvas_item;  	/* item itself */
+	gint klass_id;					/* unique class identifier */
+	gchar *sub_item;			   	/* case of an expanded node */
+	gboolean anchored;             	/* should it be anchored [e.g. paint all the 
+	                                 * data to the graph?]
+	                                 */
 	GtkWidget *menu;
 	AnjutaClassInheritance *plugin;
 } NodeData;
 
-typedef struct _NodeExpansionStatus {
-	gchar *name;
+
+typedef struct _NodeExpansionStatus {	
+	gint klass_id;
 	gint expansion_status;
+	
 } NodeExpansionStatus;
 
 
@@ -52,13 +59,20 @@
 	NODE_FULL_EXPANDED
 };
 
-	
+
+gchar *
+class_inheritance_create_agnode_key_name (const IAnjutaSymbol* symbol);
+
+IAnjutaSymbol *
+class_inheritance_get_symbol_from_agnode_key_name (AnjutaClassInheritance *plugin,
+												   const gchar *key);
+
 void class_inheritance_base_gui_init (AnjutaClassInheritance *plugin);
 void class_inheritance_update_graph (AnjutaClassInheritance *plugin);
 void class_inheritance_clean_canvas (AnjutaClassInheritance *plugin);
 void class_inheritance_show_dynamic_class_popup_menu (GdkEvent *event,
 										   NodeData* nodedata);
-void class_inheritance_hash_table_clear (AnjutaClassInheritance *plugin);
+void class_inheritance_gtree_clear (AnjutaClassInheritance *plugin);
 
 G_END_DECLS
  

Modified: trunk/plugins/class-inheritance/plugin.c
==============================================================================
--- trunk/plugins/class-inheritance/plugin.c	(original)
+++ trunk/plugins/class-inheritance/plugin.c	Thu Oct 16 20:04:41 2008
@@ -75,7 +75,7 @@
 	class_inheritance_clean_canvas (ci_plugin);
 
 	/* destroy and re-initialize the hashtable */
-	class_inheritance_hash_table_clear	(ci_plugin);
+	class_inheritance_gtree_clear (ci_plugin);
 	
 	if (ci_plugin->top_dir)
 		g_free(ci_plugin->top_dir);
@@ -137,9 +137,9 @@
 	/* clean up the canvas [e.g. destroys it's elements */
 	class_inheritance_clean_canvas (class_inheritance);
 	
-	/* destroy the nodestatus hash table */
+	/* destroy the nodestatus gtree */
 	if (class_inheritance->expansion_node_list) {
-		g_hash_table_destroy (class_inheritance->expansion_node_list);
+		g_tree_destroy (class_inheritance->expansion_node_list);
 		class_inheritance->expansion_node_list = NULL;
 	}
 	

Modified: trunk/plugins/class-inheritance/plugin.h
==============================================================================
--- trunk/plugins/class-inheritance/plugin.h	(original)
+++ trunk/plugins/class-inheritance/plugin.h	Thu Oct 16 20:04:41 2008
@@ -54,7 +54,7 @@
 	GList *drawable_list;   		/* GnomeCanvasItem* list. Edges, arrows and texts */
 	GList *node_list;					/* NodeData* list */
 
-	GHashTable *expansion_node_list;	/* expansion_status for the nodes */
+	GTree *expansion_node_list;	/* expansion_status for the nodes */
 
 	/* graphviz stuff */	
 	GVC_t *gvc;

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	Thu Oct 16 20:04:41 2008
@@ -35,7 +35,14 @@
 {
 	GdaDataModelIter *data_iter;	
 	const GHashTable *sym_type_conversion_hash;
+	gchar *project_directory;
 	gchar *uri;
+	
+	/* we'll store returned gchar* (build filepaths) here so that user can use them
+	 * as far as SymbolEngineIteratorNode exists making sure that the pointers
+	 * do not break in memory.
+	 */
+	GList *file_paths;
 };
 
 static GObjectClass* parent_class = NULL;
@@ -48,6 +55,8 @@
 	s = g_object_new (SYMBOL_TYPE_DB_ENGINE_ITERATOR_NODE, NULL);
 	s->priv->data_iter = (GdaDataModelIter *)data;
 	s->priv->uri = NULL;
+	s->priv->project_directory = NULL;
+	s->priv->file_paths = NULL;
 	
 	return s;
 }
@@ -62,6 +71,8 @@
 	sdbin->priv = g_new0 (SymbolDBEngineIteratorNodePriv, 1);
 	sdbin->priv->sym_type_conversion_hash = NULL;
 	sdbin->priv->uri = NULL;
+	sdbin->priv->project_directory = NULL;
+	sdbin->priv->file_paths = NULL;
 }
 
 static void
@@ -72,9 +83,13 @@
 	
 	dbin = SYMBOL_DB_ENGINE_ITERATOR_NODE (object);	
 	priv = dbin->priv;
-	if (priv->uri)
-		g_free (priv->uri);
+	g_free (priv->uri);
+	g_free (priv->project_directory);
 
+	/* free the paths. From this moment the pointers eventually returned become invalid */
+	if (priv->file_paths)
+		g_list_foreach (priv->file_paths, (GFunc)g_free, NULL);
+	
 	g_free (priv);
 
 	G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -187,6 +202,7 @@
 {
 	SymbolDBEngineIteratorNodePriv *priv;
 	const GValue *value = NULL;
+	gchar *filepath = NULL;
 	
 	g_return_val_if_fail (dbin != NULL, NULL);
 	priv = dbin->priv;
@@ -195,6 +211,14 @@
 	{
 		value = gda_data_model_iter_get_value_for_field (priv->data_iter, 
 														 "db_file_path");
+		/* build the absolute file path */
+		if (value != NULL && G_VALUE_HOLDS_STRING (value) && 
+			priv->project_directory != NULL)
+		{
+			filepath = g_strconcat (priv->project_directory, 
+									g_value_get_string (value),
+									NULL);
+		}
 	}	
 	else if (sym_info & SYMINFO_LANGUAGE)
 	{
@@ -242,6 +266,13 @@
 														 "file_include_type");
 	}
 
+	if (filepath != NULL) 
+	{
+		/* add a reference to GList */
+		priv->file_paths = g_list_prepend (priv->file_paths, filepath);
+		return filepath;
+	}
+	
 	return value != NULL && G_VALUE_HOLDS_STRING (value)
 		? g_value_get_string (value) : NULL;
 }
@@ -276,6 +307,21 @@
 	}
 }
 
+void
+symbol_db_engine_iterator_node_set_prj_directory (SymbolDBEngineIteratorNode *dbin,
+										const gchar *prj_directory)
+{
+	SymbolDBEngineIteratorNodePriv *priv;
+	g_return_if_fail (dbin != NULL);
+	
+	priv = dbin->priv;
+	/* save a dup of the passed prj_directory: we'll need it in case user requests
+	 * a file path: db'll return only a relative path.
+	 */
+	priv->project_directory = g_strdup (prj_directory);
+
+}
+
 /* IAnjutaSymbol implementation */
 static const gchar*
 isymbol_get_name (IAnjutaSymbol *isymbol, GError **err)

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	Thu Oct 16 20:04:41 2008
@@ -86,6 +86,10 @@
 symbol_db_engine_iterator_node_set_conversion_hash (SymbolDBEngineIteratorNode *dbin,
 										 const GHashTable *sym_type_conversion_hash);
 
+void
+symbol_db_engine_iterator_node_set_prj_directory (SymbolDBEngineIteratorNode *dbin,
+										const gchar *prj_directory);
+
 SymbolDBEngineIteratorNode *
 symbol_db_engine_iterator_node_new (const GdaDataModelIter *data);
 

Modified: trunk/plugins/symbol-db/symbol-db-engine-iterator.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-iterator.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-iterator.c	Thu Oct 16 20:04:41 2008
@@ -80,7 +80,8 @@
 
 SymbolDBEngineIterator *
 symbol_db_engine_iterator_new (GdaDataModel *model, 
-							   const GHashTable *sym_type_conversion_hash)
+							   const GHashTable *sym_type_conversion_hash,
+							   const gchar *prj_directory)
 {
 	SymbolDBEngineIterator *dbi;
 	SymbolDBEngineIteratorPriv *priv;
@@ -111,6 +112,9 @@
 
 	symbol_db_engine_iterator_node_set_conversion_hash (SYMBOL_DB_ENGINE_ITERATOR_NODE (dbi),
 														sym_type_conversion_hash);
+	
+	symbol_db_engine_iterator_node_set_prj_directory (SYMBOL_DB_ENGINE_ITERATOR_NODE (dbi),
+													  prj_directory);
 	return dbi;
 }
 
@@ -128,7 +132,6 @@
 	return gda_data_model_iter_move_at_row (priv->data_iter, 0);
 }
 
-
 gboolean
 symbol_db_engine_iterator_move_next (SymbolDBEngineIterator *dbi)
 {
@@ -241,9 +244,6 @@
 
 	if (symbol_db_engine_iterator_first (dbi) == FALSE) 
 	{
-		symbol_db_engine_iterator_node_set_data (SYMBOL_DB_ENGINE_ITERATOR_NODE (iterable),
-										 NULL);
-		
 		return FALSE;
 	}
 	symbol_db_engine_iterator_node_set_data (SYMBOL_DB_ENGINE_ITERATOR_NODE (iterable),
@@ -262,9 +262,6 @@
 
 	if (symbol_db_engine_iterator_move_next (dbi) == FALSE)
 	{
-		symbol_db_engine_iterator_node_set_data (SYMBOL_DB_ENGINE_ITERATOR_NODE (iterable),
-										 NULL);
-		
 		return FALSE;
 	}
 	symbol_db_engine_iterator_node_set_data (SYMBOL_DB_ENGINE_ITERATOR_NODE (iterable),
@@ -284,9 +281,6 @@
 
 	if (symbol_db_engine_iterator_move_prev (dbi) == FALSE)
 	{
-		symbol_db_engine_iterator_node_set_data (SYMBOL_DB_ENGINE_ITERATOR_NODE (iterable),
-										 NULL);
-		
 		return FALSE;
 	}
 	symbol_db_engine_iterator_node_set_data (SYMBOL_DB_ENGINE_ITERATOR_NODE (iterable),
@@ -306,9 +300,6 @@
 
 	if (symbol_db_engine_iterator_last (dbi) == FALSE)
 	{
-		symbol_db_engine_iterator_node_set_data (SYMBOL_DB_ENGINE_ITERATOR_NODE (iterable),
-										 NULL);
-		
 		return FALSE;
 	}
 	symbol_db_engine_iterator_node_set_data (SYMBOL_DB_ENGINE_ITERATOR_NODE (iterable),
@@ -342,9 +333,6 @@
 
 	if (symbol_db_engine_iterator_set_position (dbi, position) == FALSE)
 	{
-		symbol_db_engine_iterator_node_set_data (SYMBOL_DB_ENGINE_ITERATOR_NODE (iterable),
-										 NULL);
-		
 		return FALSE;
 	}
 	symbol_db_engine_iterator_node_set_data (SYMBOL_DB_ENGINE_ITERATOR_NODE (iterable),

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	Thu Oct 16 20:04:41 2008
@@ -58,7 +58,8 @@
 
 SymbolDBEngineIterator *
 symbol_db_engine_iterator_new (GdaDataModel *model, 
-							   const GHashTable *sym_type_conversion_hash);
+							   const GHashTable *sym_type_conversion_hash,
+							   const gchar *prj_directory);
 
 gboolean
 symbol_db_engine_iterator_first (SymbolDBEngineIterator *dbi);

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	Thu Oct 16 20:04:41 2008
@@ -6326,7 +6326,8 @@
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);	
+												priv->sym_type_conversion_hash,
+												priv->project_directory);	
 }
 
 
@@ -6479,7 +6480,8 @@
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);
+												priv->sym_type_conversion_hash,
+												priv->project_directory);
 }
 
 
@@ -6756,7 +6758,8 @@
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);
+												priv->sym_type_conversion_hash,
+												priv->project_directory);	
 }
 
 
@@ -7019,7 +7022,8 @@
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);	
+												priv->sym_type_conversion_hash,
+												priv->project_directory);	
 }
 
 /**
@@ -7190,7 +7194,8 @@
 	data = gda_connection_statement_execute_select (priv->db_connection, 
 												  (GdaStatement*)dyn_node->stmt, 
 												  (GdaSet*)dyn_node->plist, NULL);
-		
+	
+	/*gda_data_model_dump (data, stdout);*/
 	if (!GDA_IS_DATA_MODEL (data) ||
 		gda_data_model_get_n_rows (GDA_DATA_MODEL (data)) <= 0)
 	{
@@ -7205,7 +7210,8 @@
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);
+												priv->sym_type_conversion_hash,
+												priv->project_directory);	
 }
 
 /** 
@@ -7337,7 +7343,8 @@
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);
+												priv->sym_type_conversion_hash,
+												priv->project_directory);	
 }
 
 /**
@@ -7465,7 +7472,8 @@
 	g_free (db_relative_file);
 	
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);
+												priv->sym_type_conversion_hash,
+												priv->project_directory);	
 }
 
 
@@ -7582,7 +7590,8 @@
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);
+												priv->sym_type_conversion_hash,
+												priv->project_directory);	
 }
 
 
@@ -7669,7 +7678,8 @@
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);
+												priv->sym_type_conversion_hash,
+												priv->project_directory);	
 }
 
 
@@ -7765,7 +7775,8 @@
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);
+												priv->sym_type_conversion_hash,
+												priv->project_directory);	
 }
 
 /** 
@@ -8460,7 +8471,8 @@
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);
+												priv->sym_type_conversion_hash,
+												priv->project_directory);	
 }
 
 /**
@@ -8568,10 +8580,10 @@
 												  (GdaStatement*)dyn_node->stmt, 
 												  (GdaSet*)dyn_node->plist, NULL);
 		
-	DEBUG_PRINT ("symbol_db_engine_get_files_for_project (): query_str is %s",
+/*	DEBUG_PRINT ("symbol_db_engine_get_files_for_project (): query_str is %s",
 				 dyn_node->query_str);
 	DEBUG_PRINT ("symbol_db_engine_get_files_for_project (): data dump \n");
-	gda_data_model_dump (data, stdout);
+	gda_data_model_dump (data, stdout);*/
 	
 	if (!GDA_IS_DATA_MODEL (data) ||
 		gda_data_model_get_n_rows (GDA_DATA_MODEL (data)) <= 0)
@@ -8587,5 +8599,6 @@
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);	
+												priv->sym_type_conversion_hash,
+												priv->project_directory);	
 }

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	Thu Oct 16 20:04:41 2008
@@ -63,20 +63,20 @@
 	SymbolDBEnginePriv *priv;
 };
 
-
+/* WARNING: these must match the ones on libanjuta.idl [AnjutaSymbol::Field] */
 typedef enum {
-	SYMINFO_SIMPLE = 0,
-	SYMINFO_FILE_PATH = 1,
-	SYMINFO_IMPLEMENTATION = 2,
-	SYMINFO_ACCESS = 4,
-	SYMINFO_KIND = 8,
-	SYMINFO_TYPE = 16,
-	SYMINFO_TYPE_NAME = 32,
-	SYMINFO_LANGUAGE = 64,
-	SYMINFO_FILE_IGNORE = 128,
-	SYMINFO_FILE_INCLUDE = 256,
-	SYMINFO_PROJECT_NAME = 512,
-	SYMINFO_WORKSPACE_NAME = 1024
+	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;
 

Modified: trunk/plugins/symbol-db/symbol-db-view.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-view.c	Thu Oct 16 20:04:41 2008
@@ -1739,7 +1739,7 @@
 				g_warning ("sdb_view_build_and_display_base_tree (): something "
 						   "went wrong");
 				continue;
-			}
+			} 
 			/* add a dummy child */
 			sdb_view_do_add_hidden_dummy_child (dbv, dbe,
 						&child_iter, curr_symbol_id, FALSE);



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