anjuta r3553 - in branches/anjuta-symbol-db: . libanjuta/interfaces plugins/class-inheritance plugins/language-support-cpp-java plugins/profiler plugins/symbol-browser plugins/symbol-db



Author: jhs
Date: Thu Jan 31 18:36:39 2008
New Revision: 3553
URL: http://svn.gnome.org/viewvc/anjuta?rev=3553&view=rev

Log:
2008-01-28  Massimo Cora\'  <maxcvs email it>

	* plugins/symbol-db/symbol-db-view-locals.c:
	(sdb_view_locals_get_iter_from_row_ref), (sdb_view_locals_init),
	(do_add_root_symbol_to_view),
	(consume_symbols_inserted_queue_idle_destroy),
	(consume_symbols_inserted_queue_idle), (on_scan_end),
	(do_recurse_subtree_and_remove), (on_symbol_removed),
	(on_symbol_inserted),
	(symbol_db_view_locals_recv_signals_from_engine),
	(symbol_db_view_locals_update_list):
	* plugins/symbol-db/symbol-db-view.c:
	(sdb_view_get_iter_from_row_ref), (prepare_for_adding),
	(on_symbol_removed), (sdb_view_row_expanded_idle_destroy),
	(sdb_view_namespace_row_expanded), (sdb_view_global_row_expanded),
	(sdb_view_vars_row_expanded):
	added non-freezing updating to local tab symbols. Adding of symbols
	to the GtkTreeView is now done with an g_idle_add () function and G_PRIORITY_LOW.

2008-01-20  Massimo Cora\'  <maxcvs email it>

	* libanjuta/interfaces/libanjuta.idl:
	* plugins/class-inheritance/class-inherit.c:
	(class_inheritance_show_dynamic_class_popup_menu),
	(cls_inherit_add_node), (cls_inherit_draw_expanded_node),
	(class_inheritance_update_graph):
	* plugins/language-support-cpp-java/cpp-java-assist.c:
	(create_completion),
	(cpp_java_assist_create_scope_completion_cache),
	(cpp_java_assist_create_word_completion_cache),
	(cpp_java_assist_show_calltip):
	* plugins/profiler/gprof-view.c:
	(gprof_view_show_symbol_in_editor):
	* plugins/symbol-browser/an_symbol.c: (anjuta_symbol_get_name),
	(isymbol_get_name), (isymbol_get_sym_type), (isymbol_get_args),
	(isymbol_get_extra_info_string), (isymbol_get_line),
	(isymbol_get_icon), (isymbol_iface_init):
	* plugins/symbol-browser/an_symbol.h:
	* plugins/symbol-browser/an_symbol_view.c:
	(anjuta_symbol_view_get_file_symbol_model):
	* plugins/symbol-browser/plugin.c: (isymbol_manager_search),
	(isymbol_manager_get_members), (isymbol_manager_get_class_parents),
	(isymbol_manager_get_completions_at_position),
	(isymbol_manager_iface_init):
	reimplemented IAnjutaSymbolManager new functions in plugins that used those.	
	Class-inheritance is still under test, keeping an open eye on it for bugs.

	* plugins/symbol-db/plugin.c: (symbol_db_deactivate),
	(isymbol_manager_search), (isymbol_manager_get_members),
	(isymbol_manager_get_class_parents), (isymbol_manager_iface_init):
	* 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),
	(isymbol_get_name), (isymbol_get_args),
	(isymbol_get_extra_info_string), (isymbol_get_line),
	(isymbol_get_icon), (isymbol_get_sym_type), (isymbol_iface_init):
	* plugins/symbol-db/symbol-db-engine.c:
	(sdb_engine_execute_select_sql),
	(sdb_engine_timeout_trigger_signals), (sdb_engine_thread_monitor),
	(sdb_engine_scan_files_1), (sdb_engine_init),
	(sdb_engine_set_defaults_db_parameters),
	(symbol_db_engine_open_db), (symbol_db_engine_add_new_files),
	(symbol_db_engine_fill_type_array),
	(sdb_engine_prepare_symbol_info_sql),
	(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_file_symbols),
	(symbol_db_engine_get_symbol_info_by_id),
	(symbol_db_engine_find_symbol_by_name_pattern),
	(symbol_db_engine_get_parent_scope_id_by_symbol_id),
	(symbol_db_engine_find_symbol_by_name_pattern_filtered):
	* plugins/symbol-db/symbol-db-engine.h:
	* plugins/symbol-db/symbol-db-view.c:
	(sdb_view_row_expanded_idle_destroy),
	(sdb_view_namespace_row_expanded), (sdb_view_vars_row_expanded):
	Cleaned code, implemented new interface. 
	Added anjuta_launcher_disable_password_check () to avoid strange effects on 
	output parsing.

	* plugins/symbol-db/tables.sql:
	removed dead code. Initialize parameters on symbol-db-engine at connection
	establishment.

Modified:
   branches/anjuta-symbol-db/ChangeLog
   branches/anjuta-symbol-db/libanjuta/interfaces/libanjuta.idl
   branches/anjuta-symbol-db/plugins/class-inheritance/class-inherit.c
   branches/anjuta-symbol-db/plugins/language-support-cpp-java/cpp-java-assist.c
   branches/anjuta-symbol-db/plugins/profiler/gprof-view.c
   branches/anjuta-symbol-db/plugins/symbol-browser/an_symbol.c
   branches/anjuta-symbol-db/plugins/symbol-browser/an_symbol.h
   branches/anjuta-symbol-db/plugins/symbol-browser/an_symbol_view.c
   branches/anjuta-symbol-db/plugins/symbol-browser/plugin.c
   branches/anjuta-symbol-db/plugins/symbol-db/plugin.c
   branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine-iterator-node.c
   branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.c
   branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.h
   branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-view-locals.c
   branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-view.c
   branches/anjuta-symbol-db/plugins/symbol-db/tables.sql

Modified: branches/anjuta-symbol-db/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- branches/anjuta-symbol-db/libanjuta/interfaces/libanjuta.idl	(original)
+++ branches/anjuta-symbol-db/libanjuta/interfaces/libanjuta.idl	Thu Jan 31 18:36:39 2008
@@ -4297,68 +4297,94 @@
 	{
 		TYPE_UNDEF = 0,                // Unknown type
 		TYPE_CLASS = 1,                // Class declaration
-		TYPE_ENUM = 2,                 // Enum declaration
-		TYPE_ENUMERATOR = 4,           // Enumerator value
-		TYPE_FIELD = 8,                // Field (Java only)
-		TYPE_FUNCTION = 16,            // Function definition
-		TYPE_INTERFACE = 32,           // Interface (Java only)
-		TYPE_MEMBER = 64,              // Member variable of class/struct
-		TYPE_METHOD = 128,             // Class method (Java only)
-		TYPE_NAMESPACE = 256,          // Namespace declaration
+		TYPE_ENUM = 2,                 // Enum declaration 
+		TYPE_ENUMERATOR = 4,           // Enumerator value 
+		TYPE_FIELD = 8,                // Field (Java only) 
+		TYPE_FUNCTION = 16,            // Function definition 
+		TYPE_INTERFACE = 32,           // Interface (Java only) 
+		TYPE_MEMBER = 64,              // Member variable of class/struct 
+		TYPE_METHOD = 128,             // Class method (Java only) 
+		TYPE_NAMESPACE = 256,          // Namespace declaration 
 		TYPE_PACKAGE = 512,            // Package (Java only)
-		TYPE_PROTOTYPE = 1024,         // Function prototype
-		TYPE_STRUCT = 2048,            // Struct declaration
-		TYPE_TYPEDEF = 4096,           // Typedef
-		TYPE_UNION = 8192,             // Union
-		TYPE_VARIABLE = 16384,         // Variable
-		TYPE_EXTERNVAR = 32768,        // Extern or forward declaration
-		TYPE_MACRO = 65536,            //  Macro (without arguments)
-		TYPE_MACRO_WITH_ARG = 131072,  // Parameterized macro
-		TYPE_FILE = 262144,            // File (Pseudo tag)
-		TYPE_OTHER = 524288,           // Other (non C/C++/Java tag)
-		TYPE_MAX = 1048575             // Maximum value
+		TYPE_PROTOTYPE = 1024,         // Function prototype 
+		TYPE_STRUCT = 2048,            // Struct declaration 
+		TYPE_TYPEDEF = 4096,           // Typedef 
+		TYPE_UNION = 8192,             // Union 
+		TYPE_VARIABLE = 16384,         // Variable 
+		TYPE_EXTERNVAR = 32768,        // Extern or forward declaration 
+		TYPE_MACRO = 65536,            //  Macro (without arguments) 
+		TYPE_MACRO_WITH_ARG = 131072,  // Parameterized macro 
+		TYPE_FILE = 262144,            // File (Pseudo tag) 
+		TYPE_OTHER = 524288,           // Other (non C/C++/Java tag) 
+		TYPE_MAX = 1048575             // Maximum value 
 	}
 
-	// Field masks -- used mainly for search
+	/* Field masks -- used mainly to retrieve fields of a symbol */
 	enum Field
 	{
-		FIELD_NONE = 0,                 // Undefined
-		FIELD_NAME = 1,                 // Name field
-		FIELD_TYPE = 2,                 // Type field
-		FIELD_FILE = 4,                 // File field
-		FIELD_LINE = 8,                 // Line number field
-		FIELD_POSITION = 16,            // Byte pos of symbol (Obsolete)
-		FIELD_SCOPE = 32,               // Scope of the symbol field
-		FIELD_INHERITANCE = 64,         // Parent classes
-		FIELD_ARGUMENTS = 128,          // Argument list
-		FIELD_LOCAL = 256,              // If it has local scope
-		FIELD_TIME = 512,               // Modification time (File symbol only)
-		FIELD_VARTYPE = 1024,           // Variable Type
-		FIELD_ACCESS = 2048,            // Access type
-		FIELD_IMPLEMENTATION = 4096,    // Implementation (e.g. virtual)
-		FIELD_LANGUAGE = 8192,          // Language (File symbols only)
-		FIELD_INACTIVE = 16384,         // Inactive file (File symbols only)
-		FIELD_POINTER = 32768,          // Inactive file (File symbols only)
-		FIELD_MAX = 65535               // Maximum value
+
+		FIELD_SIMPLE = 0,				// With this field you will have name, line of declaration,
+										// is_file_scope and signature of the symbol 
+		FIELD_FILE_PATH = 1,
+		FIELD_IMPLEMENTATION = 2,
+		FIELD_ACCESS = 4,
+		FIELD_KIND = 8,
+		FIELD_TYPE = 16,
+		FIELD_TYPE_NAME = 32,
+		FIELD_LANGUAGE = 64,
+		FIELD_FILE_IGNORE = 128,
+		FIELD_FILE_INCLUDE = 256,
+		FIELD_PROJECT_NAME = 512,
+		FIELD_WORKSPACE_NAME = 1024
 	}
 	
-	// Methods
-	Type type ();                // Symbol type [int value]
-	const gchar *type_str ();	 // Symbol type [const char* value]
-	const gchar *type_name ();	 // Symbol type name. e.g. a member which name is 
-								 // 'my_foo_member'.
-	const gchar *name ();        // Symbol name
-	const gchar *args ();        // Args list (functions/prototypes/macros)
-	const gchar *scope ();       // Scope of symbol
-	const gchar *inheritance (); // Parent classes
-	const gchar *var_type ();    // Variable type (maps to struct for typedefs)
-	const gchar *access ();      // Access type (public/protected/private/etc.)
-	const gchar *impl ();        // Implementation (e.g. virtual)
-	const gchar *file ();   	 // File in which the symbol occurs
-	gulong line ();              // Line number of the symbol
-	gboolean is_local ();        // Is the symbol of local scope
+	/**
+	* ianjuta_symbol_get_name:
+	* The name of the symbol
+	*/
+	const gchar *get_name ();
+	
+	/**
+	* ianjuta_symbol_get_line:
+	* Line of the file in which the symbol is declared.
+	*/	
+	gulong get_line ();	
+
+	/**
+	* ianjuta_symbol_is_local:
+	* Is the symbol a static (private) one?
+	*/	
+	gboolean is_local ();
+	
+	/**
+	* ianjuta_symbol_get_args:
+	* If symbol is a function then this will return a string with the args.
+	*/	
+	const gchar *get_args ();
+
+	/**
+	 * ianjuta_symbol_get_sym_type:
+	 * You can obtain an IAnjutaSymbolType of the symbol.
+	 * To have a string representation see ianjuta_symbol_get_extra_info_string ().
+	 * You *need* a symbol with FIELD_TYPE enabled attribute. e.g. use ianjuta_symbol_manager_search
+	 * passing FIELD_TYPE as info_fields.
+	 */
+	Type get_sym_type ();
+	
+	/** 
+	* ianjuta_symbol_get_extra_info_string:
+ 	* @sym_info: Just one FIELD_* per time. It is NOT possible to pass something like
+	* FIELD_1 | FIELD_2 | ...
+ 	*/
+	const gchar *get_extra_info_string (Field sym_info);
+
+	/** 
+	 * Pixbuf icon representing the symbol. 
+	 * You *need* a symbol with FIELD_ACCESS | FIELD_KIND enabled attribute. e.g. use 
+	 * ianjuta_symbol_manager_search passing FIELD_ACCESS | FIELD_KIND as info_fields.
+	 */
+	const GdkPixbuf *get_icon ();
 	
-	const GdkPixbuf *icon ();          // Pixbuf icon representing the symbol
 }
 
 /**
@@ -4378,17 +4404,21 @@
 	/**
 	* ianjuta_symbol_manager_search:
 	* @obj: Self
-	* @match_types: fixme
+	* @match_types: If passed IANJUTA_TYPE_UNDEF the function will not perfom any filter.
+	* @include_types: Should the result contain or exclude the match_types? TRUE to include them,
+	*				  FALSE to exclude. For example use may want all symbols but classes.
 	* @match_name: fixme
-	* @partial_name_match: fixme
-	* @global_search: fixme
+	* @partial_name_match: if TRUE it will search for %match_name%, it FALSE for the exact
+	* string match_name.
+	* @global_search: if TRUE it will search only for public/extern functions. 
+	* If FALSE it will search also for static/private functions.
 	* @err: Error propagation and reporting.
 	* 
 	* Database query. Returned iterable must be unrefed after use.
 	* 
 	* Returns: fixme
 	*/
-	IAnjutaIterable* search (IAnjutaSymbolType match_types, const gchar *match_name, gboolean partial_name_match, gboolean global_search);
+	IAnjutaIterable* search (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *match_name, gboolean partial_name_match, gboolean global_search);
 	
 	/**
 	* ianjuta_symbol_manager_get_members:
@@ -4401,7 +4431,7 @@
 	* 
 	* Returns: fixme
 	*/
-	IAnjutaIterable* get_members (const gchar *symbol_name, gboolean global_search);
+	IAnjutaIterable* get_members (IAnjutaSymbol *symbol, IAnjutaSymbolField info_fields, gboolean global_search);
 	
 	/**
 	* ianjuta_symbol_manager_get_parents:
@@ -4413,7 +4443,12 @@
 	* 
 	* Returns: fixme
 	*/
-	IAnjutaIterable* get_parents (const gchar *symbol_name);
+	IAnjutaIterable* get_class_parents (IAnjutaSymbol *symbol, IAnjutaSymbolField info_fields);
+	
+	/**
+	* DEPRECATED - to be removed.
+	*/
+	IAnjutaIterable* get_completions_at_position (const gchar* file_uri, const gchar *text_buffer, const gint text_length, const gint text_pos);
 }
 
 /**

Modified: branches/anjuta-symbol-db/plugins/class-inheritance/class-inherit.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/class-inheritance/class-inherit.c	(original)
+++ branches/anjuta-symbol-db/plugins/class-inheritance/class-inherit.c	Thu Jan 31 18:36:39 2008
@@ -82,51 +82,81 @@
 	if (nodedata->name && strlen (nodedata->name))
 	{
 		IAnjutaSymbolManager *sm;
+		IAnjutaIterable *iter_searched;
+		IAnjutaIterable *iter;
+		IAnjutaSymbol *symbol_searched;
 		sm = anjuta_shell_get_interface (ANJUTA_PLUGIN (nodedata->plugin)->shell,
 										 IAnjutaSymbolManager, NULL);
-		if (sm)
+		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,
+													   NULL);
+		
+		if (iter_searched == NULL)
+			return;
+		
+		symbol_searched = IANJUTA_SYMBOL (iter_searched);
+		iter = ianjuta_symbol_manager_get_members (sm, symbol_searched,
+												   IANJUTA_SYMBOL_FIELD_SIMPLE,
+												   FALSE, NULL);
+		if (iter && ianjuta_iterable_get_length (iter, NULL) > 0)
 		{
-			IAnjutaIterable *iter;
-			iter = ianjuta_symbol_manager_get_members (sm, nodedata->name,
-													   FALSE, NULL);
-			if (iter && ianjuta_iterable_get_length (iter, NULL) > 0)
+			IAnjutaSymbol *symbol = IANJUTA_SYMBOL (iter);
+			do
 			{
-				IAnjutaSymbol *symbol = IANJUTA_SYMBOL (iter);
-				do
+				const gchar *name, *file;
+				const GdkPixbuf *pixbuf;
+				gint line;
+				
+				name = ianjuta_symbol_get_name (symbol, NULL);
+				pixbuf = ianjuta_symbol_get_icon (symbol, NULL);
+				file = ianjuta_symbol_get_extra_info_string (symbol, 
+								IANJUTA_SYMBOL_FIELD_FILE_PATH, NULL);
+				line = ianjuta_symbol_get_line (symbol, NULL);
+				
+				item = gtk_image_menu_item_new_with_label (name);
+				image = gtk_image_new_from_pixbuf ((GdkPixbuf*)pixbuf);
+				gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM
+											   (item), image);
+				
+				if (file)
 				{
-					const gchar *name, *file;
-					GdkPixbuf *pixbuf;
-					gint line;
-					
-					name = ianjuta_symbol_name (symbol, NULL);
-					pixbuf = ianjuta_symbol_icon (symbol, NULL);
-					file = ianjuta_symbol_file (symbol, NULL);
-					line = ianjuta_symbol_line (symbol, NULL);
-					
-					item = gtk_image_menu_item_new_with_label (name);
-					image = gtk_image_new_from_pixbuf (pixbuf);
-					gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM
-												   (item), image);
-					
-					if (file)
-					{
-						g_object_set_data_full (G_OBJECT (item), "__file",
-												g_strdup (file), g_free);
-						g_object_set_data (G_OBJECT (item), "__line",
-										   GINT_TO_POINTER (line));
-					}
-					gtk_container_add (GTK_CONTAINER (nodedata->menu),
-									   item);
-					g_signal_connect (G_OBJECT (item), "activate",
-												G_CALLBACK (on_member_menuitem_clicked),
-												nodedata);
-				} while (ianjuta_iterable_next (iter, NULL));
-			}
-			if (iter)
-				g_object_unref (iter);
+					g_object_set_data_full (G_OBJECT (item), "__file",
+											g_strdup (file), g_free);
+					g_object_set_data (G_OBJECT (item), "__line",
+									   GINT_TO_POINTER (line));
+				}
+				gtk_container_add (GTK_CONTAINER (nodedata->menu),
+								   item);
+				g_signal_connect (G_OBJECT (item), "activate",
+											G_CALLBACK (on_member_menuitem_clicked),
+											nodedata);
+			} while (ianjuta_iterable_next (iter, NULL));
+		}
+		if (iter)  
+		{
+			g_object_unref (iter);
 		}
+		if (iter_searched)
+		{
+			g_object_unref (iter_searched);
+		}
+			
 	}
 	
+	
 	separator = gtk_separator_menu_item_new ();
 	/* create the check menuitem */
 	checkitem = gtk_check_menu_item_new_with_label (_("Fixed data-view"));
@@ -282,7 +312,25 @@
 		if (sm)
 		{
 			IAnjutaIterable *iter;
-			iter = ianjuta_symbol_manager_get_members (sm, node_name,
+			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,
+													   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);
 			real_items_length = ianjuta_iterable_get_length (iter, NULL);
 
@@ -305,13 +353,16 @@
 					const gchar *name;
 					IAnjutaSymbol *symbol = IANJUTA_SYMBOL (iter);
 						
-					name = ianjuta_symbol_name (symbol, NULL);
+					name = ianjuta_symbol_get_name (symbol, NULL);
 					g_string_append_printf (label, "|%s", name);
 					i++;
 				} while (ianjuta_iterable_next (iter, NULL) && i < max_label_items);
 			}
 			if (iter)
 				g_object_unref (iter);
+			
+			if (iter_searched)
+				g_object_unref (iter_searched);
 		}
 		
 		if (node_status->expansion_status == NODE_HALF_EXPANDED &&
@@ -402,11 +453,30 @@
 	
 	sm = anjuta_shell_get_interface (ANJUTA_PLUGIN (plugin)->shell,
 										 IAnjutaSymbolManager, NULL);
-	if (sm) {
-		symbol_iter = ianjuta_symbol_manager_get_members (sm, node->name,
-															   FALSE, 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,
+												   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);
+						
 	/* we need to know which label to draw, wether only the "show all" or just 
 	 * the "normal view" */
 	if ( (node_status = 
@@ -505,14 +575,16 @@
 					
 			/* go on with the icons */
 			if (symbol_iter && ianjuta_iterable_get_length (symbol_iter, NULL) > 0) {
-				GdkPixbuf *pixbuf;
+				const GdkPixbuf *pixbuf;
 				const gchar* file;
 				gint line;
 				IAnjutaSymbol *symbol = IANJUTA_SYMBOL (symbol_iter);
 
-				file = ianjuta_symbol_file (symbol, NULL);
-				line = ianjuta_symbol_line (symbol, NULL);
-				pixbuf = ianjuta_symbol_icon (symbol, NULL);
+				file = ianjuta_symbol_get_extra_info_string (symbol, 
+												IANJUTA_SYMBOL_FIELD_FILE_PATH, 
+												NULL);
+				line = ianjuta_symbol_get_line (symbol, NULL);
+				pixbuf = ianjuta_symbol_get_icon (symbol, NULL);
 				
 				item = gnome_canvas_item_new (	gnome_canvas_root
 									(GNOME_CANVAS (plugin->canvas)),
@@ -543,6 +615,9 @@
 	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)),
@@ -812,7 +887,6 @@
 	IAnjutaSymbol *symbol;
 	GList *classes, *node;
 	GHashTable *class_parents;
-	gboolean first;
 
 	g_return_if_fail (plugin != NULL);
 
@@ -824,15 +898,28 @@
 	if (!sm)
 		return;
 	
-	iter = ianjuta_symbol_manager_search (sm, IANJUTA_SYMBOL_TYPE_CLASS,
-										  "", FALSE, FALSE, NULL);
+	iter = ianjuta_symbol_manager_search (sm, IANJUTA_SYMBOL_TYPE_CLASS, 
+										  TRUE,
+										  IANJUTA_SYMBOL_FIELD_SIMPLE,
+										  NULL, FALSE, TRUE, NULL);
 	if (!iter)
+	{
+		DEBUG_PRINT ("class_inheritance_update_graph (): search returned no items.");
 		return;
-	symbol = IANJUTA_SYMBOL (iter);
+	}
 	
 	DEBUG_PRINT ("Number of classes found = %d",
-				 ianjuta_iterable_get_length (iter, NULL));
-	
+				 ianjuta_iterable_get_length (iter, NULL));	
+/*	
+	do {
+		const gchar *class_name;
+		symbol = IANJUTA_SYMBOL (iter);
+		class_name = ianjuta_symbol_get_name (symbol, NULL);
+		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)
 	{
 		g_object_unref (iter);
@@ -842,70 +929,73 @@
 	/* Get all classes */
 	classes = NULL;
 	class_parents = g_hash_table_new_full (g_str_hash, g_str_equal,
-										   g_free, g_free);
-	first = TRUE;
-	while (first || ianjuta_iterable_next (iter, NULL))
-	{
-		const gchar *class_name, *parents, *old_parents;
-		
-		first = FALSE;
-		
-		class_name = ianjuta_symbol_name (symbol, NULL);
-		parents = ianjuta_symbol_inheritance (symbol, NULL);
-		
-		if (!class_name || !parents || strlen (class_name) <= 0 ||
-			strlen (parents) <= 0)
+										   g_free, g_object_unref);
+	do {
+		const gchar *class_name, *old_parents;
+		IAnjutaIterable *parents;
+
+		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 (parents == NULL || ianjuta_iterable_get_length (parents, NULL) <= 0)
+		{
+			DEBUG_PRINT ("continuing 1...");
 			continue;
+		}
+		
+		class_name = ianjuta_symbol_get_name (symbol, NULL);
 		
 		if ((old_parents = g_hash_table_lookup (class_parents, class_name)))
 		{
-			if (strcmp (parents, old_parents) != 0)
-			{
-				DEBUG_PRINT ("Class '%s' has different parents '%s' and '%s'",
-						   class_name, old_parents, parents);
-			}
+			/* we already have a class inserted with that name */
+			DEBUG_PRINT ("continuing 2...");
 			continue;
 		}
-		g_hash_table_insert (class_parents, g_strdup (class_name),
-							 g_strdup (parents));
+		
+		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));
-	}
+	} while (ianjuta_iterable_next (iter, NULL) == TRUE);
+	
 	classes = g_list_reverse (classes);
+	
+	/* we don't need the iter anymore */
 	g_object_unref (iter);
 	
 	/* For all classes get their parents */
 	node = classes;
 	while (node)
 	{
-		const gchar *class_name, *parents;
-		gchar **parentsv, **ptr;
-		
+		const gchar *class_name;
+		IAnjutaIterable *parents;
+				
 		class_name = node->data;
 		parents = g_hash_table_lookup (class_parents, class_name);
-		parentsv = g_strsplit_set (parents, ";:,", -1);
 		
-		ptr = parentsv;
-		while (*ptr)
-		{
-			if (strcmp (*ptr, "") == 0)
-			{
-				ptr++;
-				continue;
-			}
-			cls_inherit_add_node (plugin, class_name);
-			cls_inherit_add_node (plugin, *ptr);
-			cls_inherit_add_edge (plugin, *ptr, class_name);
+		do {
+			IAnjutaSymbol *symbol;
+			symbol = IANJUTA_SYMBOL (parents);
+			const gchar *parent_name;
 			
-			DEBUG_PRINT ("%s:%s", *ptr, class_name);
-			ptr++;
-		}
-		g_strfreev (parentsv);
+			parent_name = ianjuta_symbol_get_name (symbol, NULL);
+			
+			cls_inherit_add_node (plugin, class_name);
+			cls_inherit_add_node (plugin, parent_name);
+			cls_inherit_add_edge (plugin, parent_name, class_name);
+		} while (ianjuta_iterable_next (parents, NULL) == TRUE);
+
+		/* 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);
-	cls_inherit_draw_graph (plugin);	
+	cls_inherit_draw_graph (plugin);
 }
 
 static GnomeUIInfo canvas_menu_uiinfo[] = {

Modified: branches/anjuta-symbol-db/plugins/language-support-cpp-java/cpp-java-assist.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/language-support-cpp-java/cpp-java-assist.c	(original)
+++ branches/anjuta-symbol-db/plugins/language-support-cpp-java/cpp-java-assist.c	Thu Jan 31 18:36:39 2008
@@ -141,14 +141,14 @@
 	GList* suggestions = NULL;
 	do
 	{
-		const gchar* name = ianjuta_symbol_name (IANJUTA_SYMBOL(iter), NULL);
+		const gchar* name = ianjuta_symbol_get_name (IANJUTA_SYMBOL(iter), NULL);
 		if (name != NULL)
 		{
 			if (!g_hash_table_lookup (suggestions_hash, name))
 			{
 				CppJavaAssistTag *tag = g_new0 (CppJavaAssistTag, 1);
 				tag->name = g_strdup (name);
-				tag->is_func = (ianjuta_symbol_args (IANJUTA_SYMBOL (iter),
+				tag->is_func = (ianjuta_symbol_get_args (IANJUTA_SYMBOL (iter),
 													 NULL)
 								!= NULL);
 				g_hash_table_insert (suggestions_hash, (gchar*)name,
@@ -307,6 +307,8 @@
 											   const gchar *scope_operator,
 											   const gchar *scope_context)
 {
+	DEBUG_PRINT ("TODO: cpp_java_assist_create_scope_completion_cache ()");
+#if 0	
 	cpp_java_assist_destroy_completion_cache (assist);
 	if (g_str_equal (scope_operator, "::"))
 	{
@@ -327,6 +329,7 @@
 		/* TODO: Find the type of context by parsing the file somehow and
 		search for the member as it is done with the :: context */
 	}
+#endif	
 }
 
 static void
@@ -337,6 +340,8 @@
 	IAnjutaIterable* iter = 
 		ianjuta_symbol_manager_search (assist->priv->isymbol_manager,
 										IANJUTA_SYMBOL_TYPE_MAX,
+									    TRUE,
+										IANJUTA_SYMBOL_FIELD_SIMPLE,
 										pre_word, TRUE, TRUE, NULL);
 	if (iter)
 	{
@@ -493,16 +498,18 @@
 									   IANJUTA_SYMBOL_TYPE_FUNCTION|
 									   IANJUTA_SYMBOL_TYPE_METHOD|
 									   IANJUTA_SYMBOL_TYPE_MACRO_WITH_ARG,
+									   TRUE,
+									   IANJUTA_SYMBOL_FIELD_SIMPLE,
 									   call_context, FALSE, TRUE, NULL);
 	if (iter)
 	{
 		do
 		{
 			IAnjutaSymbol* symbol = IANJUTA_SYMBOL(iter);
-			const gchar* name = ianjuta_symbol_name(symbol, NULL);
+			const gchar* name = ianjuta_symbol_get_name(symbol, NULL);
 			if (name != NULL)
 			{
-				const gchar* args = ianjuta_symbol_args(symbol, NULL);
+				const gchar* args = ianjuta_symbol_get_args(symbol, NULL);
 				gchar* print_args;
 				gchar* separator;
 				gchar* white_name = g_strnfill (strlen(name) + 1, ' ');

Modified: branches/anjuta-symbol-db/plugins/profiler/gprof-view.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/profiler/gprof-view.c	(original)
+++ branches/anjuta-symbol-db/plugins/profiler/gprof-view.c	Thu Jan 31 18:36:39 2008
@@ -125,6 +125,9 @@
 	{									   	
 		symbol_iter = ianjuta_symbol_manager_search (self->priv->symbol_manager,
 													 IANJUTA_SYMBOL_TYPE_FUNCTION,
+													 IANJUTA_SYMBOL_FIELD_FILE_PATH |
+													 IANJUTA_SYMBOL_FIELD_SIMPLE,
+													 TRUE,
 													 symbol_name,
 													 FALSE,
 													 TRUE,
@@ -134,8 +137,8 @@
 			ianjuta_iterable_get_length (symbol_iter, NULL) > 0)
 		{
 			symbol = IANJUTA_SYMBOL (symbol_iter);
-			file = ianjuta_symbol_file (symbol, NULL);
-			line = ianjuta_symbol_line (symbol, NULL);
+			file = ianjuta_symbol_get_extra_info_string (symbol, IANJUTA_SYMBOL_FIELD_FILE_PATH, NULL);
+			line = ianjuta_symbol_get_line (symbol, NULL);
 			
 			ianjuta_document_manager_goto_file_line (self->priv->document_manager, 
 													 file, line, NULL);

Modified: branches/anjuta-symbol-db/plugins/symbol-browser/an_symbol.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-browser/an_symbol.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-browser/an_symbol.c	Thu Jan 31 18:36:39 2008
@@ -78,6 +78,15 @@
 	return s;
 }
 
+
+const gchar* 
+anjuta_symbol_get_name (AnjutaSymbol* symbol)
+{
+	g_return_val_if_fail (symbol != NULL, NULL);
+	
+	return symbol->priv->tm_tag->name;
+}
+
 void
 anjuta_symbol_set_tag (AnjutaSymbol *symbol, const TMTag *tm_tag)
 {
@@ -93,38 +102,8 @@
 }
 
 /* IAnjutaSymbol implementation */
-
-static IAnjutaSymbolType
-isymbol_type (IAnjutaSymbol *isymbol, GError **err)
-{
-	AnjutaSymbol *s;
-	
-	g_return_val_if_fail (ANJUTA_IS_SYMBOL (isymbol), IANJUTA_SYMBOL_TYPE_UNDEF);
-	s = ANJUTA_SYMBOL (isymbol);
-	g_return_val_if_fail (s->priv->tm_tag != NULL, IANJUTA_SYMBOL_TYPE_UNDEF);
-	return s->priv->tm_tag->type;
-}
-
-static const gchar*
-isymbol_type_name (IAnjutaSymbol *isymbol, GError **err)
-{
-	AnjutaSymbol *s;
-
-	g_return_val_if_fail (ANJUTA_IS_SYMBOL (isymbol), NULL);
-	s = ANJUTA_SYMBOL (isymbol);
-	g_return_val_if_fail (s->priv->tm_tag != NULL, NULL);
-	return s->priv->tm_tag->atts.entry.type_ref[1];
-}
-
-static const gchar*
-isymbol_type_str (IAnjutaSymbol *isymbol, GError **err)
-{
-	DEBUG_PRINT ("TODO: isymbol_type_str ()");
-	return NULL;
-}
-
 static const gchar*
-isymbol_name (IAnjutaSymbol *isymbol, GError **err)
+isymbol_get_name (IAnjutaSymbol *isymbol, GError **err)
 {
 	AnjutaSymbol *s;
 
@@ -134,83 +113,88 @@
 	return s->priv->tm_tag->name;
 }
 
-static const gchar*
-isymbol_args (IAnjutaSymbol *isymbol, GError **err)
+static IAnjutaSymbolType
+isymbol_get_sym_type (IAnjutaSymbol *isymbol, GError **err)
 {
 	AnjutaSymbol *s;
-
-	g_return_val_if_fail (ANJUTA_IS_SYMBOL (isymbol), NULL);
+	
+	g_return_val_if_fail (ANJUTA_IS_SYMBOL (isymbol), IANJUTA_SYMBOL_TYPE_UNDEF);
 	s = ANJUTA_SYMBOL (isymbol);
-	g_return_val_if_fail (s->priv->tm_tag != NULL, NULL);
-	return s->priv->tm_tag->atts.entry.arglist;
+	g_return_val_if_fail (s->priv->tm_tag != NULL, IANJUTA_SYMBOL_TYPE_UNDEF);
+	return s->priv->tm_tag->type;
 }
 
 static const gchar*
-isymbol_scope (IAnjutaSymbol *isymbol, GError **err)
+isymbol_get_args (IAnjutaSymbol *isymbol, GError **err)
 {
 	AnjutaSymbol *s;
 
 	g_return_val_if_fail (ANJUTA_IS_SYMBOL (isymbol), NULL);
 	s = ANJUTA_SYMBOL (isymbol);
 	g_return_val_if_fail (s->priv->tm_tag != NULL, NULL);
-	return s->priv->tm_tag->atts.entry.scope;
+	return s->priv->tm_tag->atts.entry.arglist;
 }
 
 static const gchar*
-isymbol_inheritance (IAnjutaSymbol *isymbol, GError **err)
+isymbol_get_extra_info_string (IAnjutaSymbol *isymbol, IAnjutaSymbolField sym_info,
+							   GError **err)
 {
 	AnjutaSymbol *s;
 
 	g_return_val_if_fail (ANJUTA_IS_SYMBOL (isymbol), NULL);
 	s = ANJUTA_SYMBOL (isymbol);
 	g_return_val_if_fail (s->priv->tm_tag != NULL, NULL);
-//	return s->priv->tm_tag->atts.entry.inheritance;
-	DEBUG_PRINT ("isymbol_inheritance () FIXME");
-	return NULL;
-}
-
-static const gchar*
-isymbol_access (IAnjutaSymbol *isymbol, GError **err)
-{
-	AnjutaSymbol *s;
-
-	g_return_val_if_fail (ANJUTA_IS_SYMBOL (isymbol), '\0');
-	s = ANJUTA_SYMBOL (isymbol);
-	g_return_val_if_fail (s->priv->tm_tag != NULL, '\0');
-	DEBUG_PRINT ("isymbol_access () FIXME");
-	return "fixme";
-//	return s->priv->tm_tag->atts.entry.access;
-}
-
-static const gchar*
-isymbol_impl (IAnjutaSymbol *isymbol, GError **err)
-{
-	AnjutaSymbol *s;
-
-	g_return_val_if_fail (ANJUTA_IS_SYMBOL (isymbol), '\0');
-	s = ANJUTA_SYMBOL (isymbol);
-	g_return_val_if_fail (s->priv->tm_tag != NULL, '\0');
-	DEBUG_PRINT ("isymbol_impl () FIXME");
-	return "fixme";
 	
-//	return s->priv->tm_tag->atts.entry.impl;	
-}
-
-static const gchar*
-isymbol_file (IAnjutaSymbol *isymbol, GError **err)
-{
-	AnjutaSymbol *s;
-
-	g_return_val_if_fail (ANJUTA_IS_SYMBOL (isymbol), NULL);
-	s = ANJUTA_SYMBOL (isymbol);
-	g_return_val_if_fail (s->priv->tm_tag != NULL, NULL);
-	if (s->priv->tm_tag->atts.entry.file == NULL)
-		return NULL;
-	return s->priv->tm_tag->atts.entry.file->work_object.file_name;
-}
+	switch (sym_info) {
+		case IANJUTA_SYMBOL_FIELD_FILE_PATH:
+			if (s->priv->tm_tag->atts.entry.file == NULL)
+				return NULL;
+			return s->priv->tm_tag->atts.entry.file->work_object.file_name;
+			
+		case IANJUTA_SYMBOL_FIELD_IMPLEMENTATION:
+			g_message ("TODO IANJUTA_SYMBOL_FIELD_IMPLEMENTATION");
+			return NULL;
+			/*return s->priv->tm_tag->atts.entry.impl;*/
+		
+		case IANJUTA_SYMBOL_FIELD_ACCESS:
+			g_message ("TODO IANJUTA_SYMBOL_FIELD_ACCESS");
+			return NULL;
+			/*return s->priv->tm_tag->atts.entry.access;*/
+		
+		case IANJUTA_SYMBOL_FIELD_KIND:
+			g_message ("No symbol kind to string translation available");
+			return NULL;
+			
+		case IANJUTA_SYMBOL_FIELD_TYPE:
+			g_message ("No symbol type to string translation available");
+			return NULL;		
+		
+		case IANJUTA_SYMBOL_FIELD_TYPE_NAME:
+			return s->priv->tm_tag->atts.entry.type_ref[1];
+		
+		case IANJUTA_SYMBOL_FIELD_LANGUAGE:
+			g_message ("No file language available");
+			return NULL;
+		
+		case IANJUTA_SYMBOL_FIELD_FILE_IGNORE:
+			return NULL;
+		
+		case IANJUTA_SYMBOL_FIELD_FILE_INCLUDE:
+			return NULL;
+		
+		case IANJUTA_SYMBOL_FIELD_PROJECT_NAME:
+			return NULL;
+		
+		case IANJUTA_SYMBOL_FIELD_WORKSPACE_NAME:
+			return NULL;
+		
+		default:
+			return NULL;
+	}
+} 
 
 static gulong
-isymbol_line (IAnjutaSymbol *isymbol, GError **err)
+isymbol_get_line (IAnjutaSymbol *isymbol, GError **err)
 {
 	AnjutaSymbol *s;
 
@@ -232,7 +216,7 @@
 }
 
 static const GdkPixbuf*
-isymbol_icon (IAnjutaSymbol *isymbol, GError **err)
+isymbol_get_icon (IAnjutaSymbol *isymbol, GError **err)
 {
 	AnjutaSymbol *s;
 	SVNodeType node_type;
@@ -247,23 +231,18 @@
 static void
 isymbol_iface_init (IAnjutaSymbolIface *iface)
 {
-	iface->type = isymbol_type;
-	iface->type_str = isymbol_type_str;	
-	iface->type_name = isymbol_type_name;
-	iface->name = isymbol_name;
-	iface->args = isymbol_args;
-	iface->scope = isymbol_scope;
-	iface->inheritance = isymbol_inheritance;	
-	iface->access = isymbol_access;
-	iface->impl = isymbol_impl;
-	iface->file = isymbol_file;
-	iface->line = isymbol_line;
+	iface->get_name = isymbol_get_name;	
+	iface->get_line = isymbol_get_line;
 	iface->is_local = isymbol_is_local;
-	iface->icon = isymbol_icon;
+	iface->get_sym_type = isymbol_get_sym_type;
+	iface->get_args = isymbol_get_args;
+	iface->get_extra_info_string = isymbol_get_extra_info_string;
+	iface->get_icon = isymbol_get_icon;
 }
 
+
 ANJUTA_TYPE_BEGIN (AnjutaSymbol, anjuta_symbol, G_TYPE_OBJECT);
 ANJUTA_TYPE_ADD_INTERFACE (isymbol, IANJUTA_TYPE_SYMBOL);
 ANJUTA_TYPE_END;
 
-/* IAnjutaIterable implementation */
+

Modified: branches/anjuta-symbol-db/plugins/symbol-browser/an_symbol.h
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-browser/an_symbol.h	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-browser/an_symbol.h	Thu Jan 31 18:36:39 2008
@@ -47,6 +47,7 @@
 GType anjuta_symbol_get_type (void);
 AnjutaSymbol* anjuta_symbol_new (const TMTag *tm_tag);
 void anjuta_symbol_set_tag (AnjutaSymbol* symbol, const TMTag *tm_tag);
+const gchar* anjuta_symbol_get_name (AnjutaSymbol* symbol);
 
 G_END_DECLS
 #endif

Modified: branches/anjuta-symbol-db/plugins/symbol-browser/an_symbol_view.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-browser/an_symbol_view.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-browser/an_symbol_view.c	Thu Jan 31 18:36:39 2008
@@ -1163,6 +1163,7 @@
 GtkTreeModel *
 anjuta_symbol_view_get_file_symbol_model (AnjutaSymbolView * sv)
 {
+	g_return_val_if_fail (sv != NULL, NULL);
 	return sv->priv->file_symbol_model;
 }
 

Modified: branches/anjuta-symbol-db/plugins/symbol-browser/plugin.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-browser/plugin.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-browser/plugin.c	Thu Jan 31 18:36:39 2008
@@ -1133,6 +1133,8 @@
 static IAnjutaIterable*
 isymbol_manager_search (IAnjutaSymbolManager *sm,
 						IAnjutaSymbolType match_types,
+						gboolean include_types,
+						IAnjutaSymbolField info_fields,
 						const gchar *match_name,
 						gboolean partial_name_match,
 						gboolean global_search,
@@ -1159,14 +1161,18 @@
 
 static IAnjutaIterable*
 isymbol_manager_get_members (IAnjutaSymbolManager *sm,
-							 const gchar *symbol_name,
+							 IAnjutaSymbol *symbol, 
+							 IAnjutaSymbolField info_fields,
 							 gboolean global_search,
 							 GError **err)
 {
 	const GPtrArray *tags_array;
 	AnjutaSymbolIter *iter = NULL;
+	AnjutaSymbol *s;
 	
-	tags_array = tm_workspace_find_scope_members (NULL, symbol_name,
+	s = ANJUTA_SYMBOL (symbol);
+	
+	tags_array = tm_workspace_find_scope_members (NULL, anjuta_symbol_get_name (s),
 												  global_search, TRUE);
 												  
 	
@@ -1179,14 +1185,18 @@
 }
 
 static IAnjutaIterable*
-isymbol_manager_get_parents (IAnjutaSymbolManager *sm,
-							 const gchar *symbol_name,
+isymbol_manager_get_class_parents (IAnjutaSymbolManager *sm,
+							 IAnjutaSymbol *symbol,
+							 IAnjutaSymbolField info_fields,
 							 GError **err)
 {
 	const GPtrArray *tags_array;
 	AnjutaSymbolIter *iter = NULL;
+	AnjutaSymbol *s;
+	
+	s = ANJUTA_SYMBOL (symbol);
 	
-	tags_array = tm_workspace_get_parents (symbol_name);
+	tags_array = tm_workspace_get_parents (anjuta_symbol_get_name (s));
 	if (tags_array && tags_array->len)
 	{
 		iter = anjuta_symbol_iter_new (tags_array);
@@ -1195,12 +1205,92 @@
 	return NULL;
 }
 
+/* DEPRECATED */
+static IAnjutaIterable*
+isymbol_manager_get_completions_at_position (IAnjutaSymbolManager *sm,
+											const gchar *file_uri,
+							 				const gchar *text_buffer, 
+											gint text_length, 
+											gint text_pos,
+							 				GError **err)
+{
+	SymbolBrowserPlugin *sv_plugin;
+	const TMTag *func_scope_tag;
+	TMSourceFile *tm_file;
+	IAnjutaEditor *ed;
+	AnjutaSymbolView *symbol_view;
+	gulong line;
+	gulong scope_position;
+	gchar *needed_text = NULL;
+	gint access_method;
+	GPtrArray * completable_tags_array;
+	AnjutaSymbolIter *iter = NULL;
+	
+	sv_plugin = ANJUTA_PLUGIN_SYMBOL_BROWSER (sm);
+	ed = IANJUTA_EDITOR (sv_plugin->current_editor);	
+	symbol_view = ANJUTA_SYMBOL_VIEW (sv_plugin->sv_tree);
+	
+	line = ianjuta_editor_get_line_from_position (ed, text_pos, NULL);
+	
+	/* get the function scope */
+	tm_file = anjuta_symbol_view_get_tm_file (symbol_view, file_uri);
+	
+	/* check whether the current file_uri is listed in the tm_workspace or not... */	
+	if (tm_file == NULL)
+		return 	NULL;
+		
+	func_scope_tag = tm_get_current_function (tm_file->work_object.tags_array, line);
+		
+	if (func_scope_tag == NULL) {
+		DEBUG_PRINT ("func_scope_tag is NULL, seems like it's a completion on a global scope");
+		return NULL;
+	}
+	
+	DEBUG_PRINT ("current expression scope: %s", func_scope_tag->name);
+	
+	
+	scope_position = ianjuta_editor_get_line_begin_position (ed, func_scope_tag->atts.entry.line, NULL);
+	needed_text = ianjuta_editor_get_text (ed, scope_position,
+										   text_pos - scope_position, NULL);
+
+	if (needed_text == NULL)
+		DEBUG_PRINT ("needed_text is null");
+	DEBUG_PRINT ("text needed is %s", needed_text );
+	
+
+	/* we'll pass only the text of the current scope: i.e. only the current function
+	 * in which we request the completion. */
+	TMTag * found_type = anjuta_symbol_view_get_type_of_expression (symbol_view, 
+				needed_text, text_pos - scope_position, func_scope_tag, &access_method);
+
+				
+	if (found_type == NULL) {
+		DEBUG_PRINT ("type not found.");
+		return NULL;	
+	}
+	
+	/* get the completable memebers. If the access is COMPLETION_ACCESS_STATIC we don't
+	 * want to know the parents members of the class.
+	 */
+	if (access_method == COMPLETION_ACCESS_STATIC)
+		completable_tags_array = anjuta_symbol_view_get_completable_members (found_type, FALSE);
+	else
+		completable_tags_array = anjuta_symbol_view_get_completable_members (found_type, TRUE);
+	
+	if (completable_tags_array && completable_tags_array->len)
+	{
+		iter = anjuta_symbol_iter_new (completable_tags_array);
+		return IANJUTA_ITERABLE (iter);
+	}
+	return NULL;
+}
+
 static void
 isymbol_manager_iface_init (IAnjutaSymbolManagerIface *iface)
 {
 	iface->search = isymbol_manager_search;
 	iface->get_members = isymbol_manager_get_members;
-	iface->get_parents = isymbol_manager_get_parents;
+	iface->get_class_parents = isymbol_manager_get_class_parents;
 }
 
 static void

Modified: branches/anjuta-symbol-db/plugins/symbol-db/plugin.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/plugin.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/plugin.c	Thu Jan 31 18:36:39 2008
@@ -331,6 +331,11 @@
 	local_path = gnome_vfs_get_local_path_from_uri (uri);
 	DEBUG_PRINT ("value_added_current_editor () gonna refresh local syms: local_path %s "
 				 "uri %s", local_path, uri);
+	if (local_path == NULL)
+	{
+		g_critical ("FIXME local_path == NULL");
+		return;
+	}
 	
 	if (strstr (local_path, "//") != NULL)
 	{
@@ -1121,7 +1126,6 @@
 	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (plugin);
 
 	DEBUG_PRINT ("SymbolDBPlugin: Dectivating SymbolDBPlugin plugin ...");
-
 	DEBUG_PRINT ("SymbolDBPlugin: destroying engine ...");
 	g_object_unref (sdb_plugin->sdbe);
 	sdb_plugin->sdbe = NULL;
@@ -1205,6 +1209,8 @@
 static IAnjutaIterable*
 isymbol_manager_search (IAnjutaSymbolManager *sm,
 						IAnjutaSymbolType match_types,
+						gboolean include_types,
+						IAnjutaSymbolField info_fields,
 						const gchar *match_name,
 						gboolean partial_name_match,
 						gboolean global_search,
@@ -1213,53 +1219,89 @@
 	SymbolDBEngineIterator *iterator = NULL;
 	SymbolDBPlugin *sdb_plugin;
 	SymbolDBEngine *dbe;
-	const gchar* name;
+	GPtrArray *filter_array;
 
 	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (sm);
 	dbe = SYMBOL_DB_ENGINE (sdb_plugin->sdbe);
 	
-	if (match_name && strlen (match_name) > 0)
-		name = match_name;
+	if (global_search == FALSE)
+	{
+		g_message ("isymbol_manager_search (): TODO: search provide only global searches for now");
+		return NULL;
+	}
+
+	if (match_types & IANJUTA_SYMBOL_TYPE_UNDEF)
+		filter_array = NULL;
 	else
-		name = NULL;
-	
-	iterator = 
-		symbol_db_engine_find_symbol_by_name_pattern (dbe, 
-									name, SYMINFO_SIMPLE |
-								  	SYMINFO_FILE_PATH |
-									SYMINFO_IMPLEMENTATION |
-									SYMINFO_ACCESS |
-									SYMINFO_KIND |
-									SYMINFO_TYPE |
-									SYMINFO_TYPE_NAME |
-									SYMINFO_LANGUAGE |
-									SYMINFO_FILE_IGNORE |
-									SYMINFO_FILE_INCLUDE |
-									SYMINFO_PROJECT_NAME |
-									SYMINFO_WORKSPACE_NAME );
+		filter_array = symbol_db_engine_fill_type_array (match_types);
 
+	iterator = symbol_db_engine_find_symbol_by_name_pattern_filtered (dbe,
+																	  match_name,
+																	  !partial_name_match,
+																	  filter_array,
+																	  include_types,
+																	  global_search,
+																	  info_fields);
+
+	if (filter_array)
+	{
+		g_ptr_array_foreach (filter_array, (GFunc)g_free, NULL);
+		g_ptr_array_free (filter_array, TRUE);
+	}
 	return IANJUTA_ITERABLE (iterator);
 }
 
 static IAnjutaIterable*
 isymbol_manager_get_members (IAnjutaSymbolManager *sm,
-							 const gchar *symbol_name,
+							 IAnjutaSymbol *symbol, 
+							 IAnjutaSymbolField info_fields,
 							 gboolean global_search,
 							 GError **err)
 {
-	/* TODO */
-	DEBUG_PRINT ("TODO: isymbol_manager_get_members ()");
-	return NULL;
+	SymbolDBEngineIteratorNode *node;
+	SymbolDBPlugin *sdb_plugin;
+	SymbolDBEngine *dbe;
+	gint sym_id;
+	SymbolDBEngineIterator *iterator;
+
+	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (sm);
+	dbe = SYMBOL_DB_ENGINE (sdb_plugin->sdbe);
+	
+	node = SYMBOL_DB_ENGINE_ITERATOR_NODE (symbol);
+	
+	sym_id = symbol_db_engine_iterator_node_get_symbol_id (node);
+	
+	iterator = symbol_db_engine_get_scope_members_by_symbol_id (dbe,
+																sym_id,
+																-1, 
+																-1,
+																info_fields);
+	return IANJUTA_ITERABLE (iterator);
 }
 
 static IAnjutaIterable*
-isymbol_manager_get_parents (IAnjutaSymbolManager *sm,
-							 const gchar *symbol_name,
+isymbol_manager_get_class_parents (IAnjutaSymbolManager *sm,
+							 IAnjutaSymbol *symbol,
+							 IAnjutaSymbolField info_fields,
 							 GError **err)
 {
-	/* TODO */
-	DEBUG_PRINT ("TODO: isymbol_manager_get_parents ()");
-	return NULL;
+	SymbolDBEngineIteratorNode *node;
+	SymbolDBPlugin *sdb_plugin;
+	SymbolDBEngine *dbe;
+	gint sym_id;
+	SymbolDBEngineIterator *iterator;
+
+	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (sm);
+	dbe = SYMBOL_DB_ENGINE (sdb_plugin->sdbe);
+	
+	node = SYMBOL_DB_ENGINE_ITERATOR_NODE (symbol);
+	
+	sym_id = symbol_db_engine_iterator_node_get_symbol_id (node);
+	
+	iterator = symbol_db_engine_get_class_parents_by_symbol_id (dbe, 
+																sym_id, 
+																info_fields);
+	return IANJUTA_ITERABLE (iterator);
 }
 
 static void
@@ -1267,7 +1309,7 @@
 {
 	iface->search = isymbol_manager_search;
 	iface->get_members = isymbol_manager_get_members;
-	iface->get_parents = isymbol_manager_get_parents;
+	iface->get_class_parents = isymbol_manager_get_class_parents;
 }
 
 ANJUTA_PLUGIN_BEGIN (SymbolDBPlugin, symbol_db);

Modified: branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine-iterator-node.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine-iterator-node.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine-iterator-node.c	Thu Jan 31 18:36:39 2008
@@ -42,7 +42,6 @@
 SymbolDBEngineIteratorNode *
 symbol_db_engine_iterator_node_new (const GdaDataModelIter *data)
 {	
-/*	DEBUG_PRINT ("sdb_engine_iterator_node_new ()");*/
 	SymbolDBEngineIteratorNode *s;
 	s = g_object_new (SYMBOL_TYPE_DB_ENGINE_ITERATOR_NODE, NULL);
 	s->priv->data_iter = (GdaDataModelIter *)data;
@@ -54,7 +53,6 @@
 sdb_engine_iterator_node_instance_init (SymbolDBEngineIteratorNode *object)
 {
 	SymbolDBEngineIteratorNode *sdbin;
-/*	DEBUG_PRINT ("sdb_engine_iterator_node_instance_init ()");*/
 	
 	sdbin = SYMBOL_DB_ENGINE_ITERATOR_NODE (object);
 	
@@ -65,12 +63,9 @@
 static void
 sdb_engine_iterator_node_finalize (GObject *object)
 {
-	/* TODO: Add deinitalization code here */
 	SymbolDBEngineIteratorNode *dbin;
 	SymbolDBEngineIteratorNodePriv *priv;
 	
-/*	DEBUG_PRINT ("sdb_engine_iterator_node_finalize ()");*/
-	
 	dbin = SYMBOL_DB_ENGINE_ITERATOR_NODE (object);	
 	priv = dbin->priv;
 
@@ -202,22 +197,7 @@
 	
 	g_return_val_if_fail (dbin != NULL, NULL);
 	priv = dbin->priv;
-#if 0	
-	DEBUG_PRINT ("symbol_db_engine_iterator_node_get_symbol_extra_string () for %d", 
-				 sym_info);
-
-	if (GDA_PARAMETER_LIST(priv->data_iter)) {
-		g_print ("-Parameter(s):\n");
-		GSList *params;
-		for (params = GDA_PARAMETER_LIST(priv->data_iter)->parameters; params; 
-			 params = params->next) {
-			GdaParameter *parameter = GDA_PARAMETER (params->data);
-			g_print ("   - name:%s type:%s\n",
-				 gda_object_get_name (GDA_OBJECT (parameter)),
-				 g_type_name (gda_parameter_get_g_type (parameter)));
-		}
-	}
-#endif	
+	
 	if (sym_info & SYMINFO_FILE_PATH)
 	{
 		par = gda_parameter_list_find_param (GDA_PARAMETER_LIST(priv->data_iter),
@@ -305,65 +285,9 @@
 	priv->data_iter = GDA_DATA_MODEL_ITER (data);
 }
 
-
 /* IAnjutaSymbol implementation */
-static IAnjutaSymbolType
-isymbol_type (IAnjutaSymbol *isymbol, GError **err)
-{
-	SymbolDBEngineIteratorNode *s;
-	SymbolDBEngineIteratorNodePriv *priv;
-	gpointer tag_found;
-	const gchar* find_str;
-	
-	g_return_val_if_fail (SYMBOL_IS_DB_ENGINE_ITERATOR_NODE (isymbol), 
-						  IANJUTA_SYMBOL_TYPE_UNDEF);
-	
-	s = SYMBOL_DB_ENGINE_ITERATOR_NODE (isymbol);
-	priv = s->priv;
-	
-	find_str = symbol_db_engine_iterator_node_get_symbol_extra_string (s,
-												   SYMINFO_TYPE);
-	if (find_str == NULL) {
-		DEBUG_PRINT ("isymbol_type (): find_str is NULL");
-		return IANJUTA_SYMBOL_TYPE_UNDEF;												   
-	}
-												   
-	tag_found = g_hash_table_lookup (priv->sym_type_conversion_hash, find_str);
-	
-	if (tag_found == NULL) {
-		DEBUG_PRINT ("isymbol_type (): nothing matching ");
-		return IANJUTA_SYMBOL_TYPE_UNDEF;
-	}
-	
-	return (IAnjutaSymbolType)tag_found;
-}
-
-
 static const gchar*
-isymbol_type_str (IAnjutaSymbol *isymbol, GError **err)
-{
-	SymbolDBEngineIteratorNode *s;
-
-	g_return_val_if_fail (SYMBOL_IS_DB_ENGINE_ITERATOR (isymbol),  NULL);
-	s = SYMBOL_DB_ENGINE_ITERATOR_NODE (isymbol);
-	return symbol_db_engine_iterator_node_get_symbol_extra_string (s, 
-								SYMINFO_TYPE);
-}
-
-static const gchar*
-isymbol_type_name (IAnjutaSymbol *isymbol, GError **err)
-{
-	SymbolDBEngineIteratorNode *s;
-
-	g_return_val_if_fail (SYMBOL_IS_DB_ENGINE_ITERATOR (isymbol),  NULL);
-	s = SYMBOL_DB_ENGINE_ITERATOR_NODE (isymbol);
-	return symbol_db_engine_iterator_node_get_symbol_extra_string (s, 
-								SYMINFO_TYPE_NAME);
-}
-
-
-static const gchar*
-isymbol_name (IAnjutaSymbol *isymbol, GError **err)
+isymbol_get_name (IAnjutaSymbol *isymbol, GError **err)
 {
 	SymbolDBEngineIteratorNode *s;
 
@@ -374,7 +298,7 @@
 }
 
 static const gchar*
-isymbol_args (IAnjutaSymbol *isymbol, GError **err)
+isymbol_get_args (IAnjutaSymbol *isymbol, GError **err)
 {
 	SymbolDBEngineIteratorNode *s;
 
@@ -384,65 +308,18 @@
 }
 
 static const gchar*
-isymbol_scope (IAnjutaSymbol *isymbol, GError **err)
-{
-	SymbolDBEngineIteratorNode *s;
-
-	g_return_val_if_fail (SYMBOL_IS_DB_ENGINE_ITERATOR (isymbol),  NULL);
-	s = SYMBOL_DB_ENGINE_ITERATOR_NODE (isymbol);
-//	g_return_val_if_fail (s->priv->tm_tag != NULL, NULL);
-//	return s->priv->tm_tag->atts.entry.scope;
-	return NULL;
-}
-
-static const gchar*
-isymbol_inheritance (IAnjutaSymbol *isymbol, GError **err)
-{
-	SymbolDBEngineIteratorNode *s;
-
-	g_return_val_if_fail (SYMBOL_IS_DB_ENGINE_ITERATOR (isymbol),  NULL);
-	s = SYMBOL_DB_ENGINE_ITERATOR_NODE (isymbol);
-//	g_return_val_if_fail (s->priv->tm_tag != NULL, NULL);
-//	return s->priv->tm_tag->atts.entry.inheritance;
-//	return 
-	return NULL;
-}
-
-static const gchar*
-isymbol_access (IAnjutaSymbol *isymbol, GError **err)
+isymbol_get_extra_info_string (IAnjutaSymbol *isymbol, IAnjutaSymbolField sym_info,
+							   GError **err)
 {
 	SymbolDBEngineIteratorNode *s;
 
 	g_return_val_if_fail (SYMBOL_IS_DB_ENGINE_ITERATOR (isymbol), NULL);
 	s = SYMBOL_DB_ENGINE_ITERATOR_NODE (isymbol);
-	return symbol_db_engine_iterator_node_get_symbol_extra_string (s, 
-																SYMINFO_ACCESS);
-}
-
-static const gchar*
-isymbol_impl (IAnjutaSymbol *isymbol, GError **err)
-{
-	SymbolDBEngineIteratorNode *s;
-
-	g_return_val_if_fail (SYMBOL_IS_DB_ENGINE_ITERATOR (isymbol), NULL);
-	s = SYMBOL_DB_ENGINE_ITERATOR_NODE (isymbol);
-	return symbol_db_engine_iterator_node_get_symbol_extra_string (s, 
-													SYMINFO_IMPLEMENTATION);
-}
-
-static const gchar*
-isymbol_file (IAnjutaSymbol *isymbol, GError **err)
-{
-	SymbolDBEngineIteratorNode *s;
-
-	g_return_val_if_fail (SYMBOL_IS_DB_ENGINE_ITERATOR (isymbol),  NULL);
-	s = SYMBOL_DB_ENGINE_ITERATOR_NODE (isymbol);
-	return symbol_db_engine_iterator_node_get_symbol_extra_string (s, 
-													SYMINFO_FILE_PATH);
-}
+	return symbol_db_engine_iterator_node_get_symbol_extra_string (s, sym_info);
+} 
 
 static gulong
-isymbol_line (IAnjutaSymbol *isymbol, GError **err)
+isymbol_get_line (IAnjutaSymbol *isymbol, GError **err)
 {
 	SymbolDBEngineIteratorNode *s;
 
@@ -462,7 +339,7 @@
 }
 
 static const GdkPixbuf*
-isymbol_icon (IAnjutaSymbol *isymbol, GError **err)
+isymbol_get_icon (IAnjutaSymbol *isymbol, GError **err)
 {
 	SymbolDBEngineIteratorNode *s;
 	
@@ -476,22 +353,41 @@
 								SYMINFO_ACCESS));
 }
 
+static IAnjutaSymbolType 
+isymbol_get_sym_type (IAnjutaSymbol *isymbol, GError **err)
+{
+	SymbolDBEngineIteratorNode *s;
+	SymbolDBEngineIteratorNodePriv *priv;
+	const gchar* type_str;
+	gint type;
+	
+	g_return_val_if_fail (SYMBOL_IS_DB_ENGINE_ITERATOR (isymbol), 
+						  IANJUTA_SYMBOL_TYPE_UNDEF);
+	s = SYMBOL_DB_ENGINE_ITERATOR_NODE (isymbol);
+	
+	priv = s->priv;
+	
+	type_str = symbol_db_engine_iterator_node_get_symbol_extra_string (s, 
+												   IANJUTA_SYMBOL_FIELD_TYPE);
+	if (type_str == NULL)
+		return IANJUTA_SYMBOL_TYPE_UNDEF;
+
+	type = (IAnjutaSymbolType)g_hash_table_lookup ((GHashTable*)priv->sym_type_conversion_hash, 
+									  type_str);
+
+	return type;
+}
+
 static void
 isymbol_iface_init (IAnjutaSymbolIface *iface)
 {
-	iface->type = isymbol_type;
-	iface->type_str = isymbol_type_str;	
-	iface->type_name = isymbol_type_name;
-	iface->name = isymbol_name;
-	iface->args = isymbol_args;
-	iface->scope = isymbol_scope;
-	iface->inheritance = isymbol_inheritance;	
-	iface->access = isymbol_access;
-	iface->impl = isymbol_impl;
-	iface->file = isymbol_file;
-	iface->line = isymbol_line;
+	iface->get_name = isymbol_get_name;	
+	iface->get_line = isymbol_get_line;
+	iface->get_sym_type = isymbol_get_sym_type;
 	iface->is_local = isymbol_is_local;
-	iface->icon = isymbol_icon;
+	iface->get_args = isymbol_get_args;
+	iface->get_extra_info_string = isymbol_get_extra_info_string;
+	iface->get_icon = isymbol_get_icon;
 }
 
 ANJUTA_TYPE_BEGIN (SymbolDBEngineIteratorNode, sdb_engine_iterator_node, G_TYPE_OBJECT);

Modified: branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.c	Thu Jan 31 18:36:39 2008
@@ -581,17 +581,12 @@
 	SymbolDBEnginePriv *priv;
 	GdaQuery *query;
 	GdaObject *obj;
-	GError *error = NULL;
 
 	priv = dbe->priv;
 
-	query = gda_query_new_from_sql (NULL, buffer, &error);
-/*	
-	if (error)
-		g_print ("Parser ERROR: %s\n", error->message);
-*/
-	obj = gda_query_execute (query, NULL, FALSE, NULL);
+	query = gda_query_new_from_sql (NULL, buffer, NULL);
 
+	obj = gda_query_execute (query, NULL, FALSE, NULL);
 	
 	if (query != NULL)
 	{
@@ -611,7 +606,7 @@
 
 
 /**
- * Will test the opened project within the dbe plugin and the passed one.
+ * Test the opened project within the dbe plugin and the passed one.
  */
 gboolean inline
 symbol_db_engine_is_project_opened (SymbolDBEngine *dbe, const gchar* project_name)
@@ -991,7 +986,7 @@
 	
 	priv = dbe->priv;
 		
-	DEBUG_PRINT ("signals trigger");
+/*	DEBUG_PRINT ("signals trigger");*/
 	if (g_async_queue_length (priv->signals_queue) > 0)
 	{
 		gpointer tmp;
@@ -1072,7 +1067,7 @@
 	g_return_val_if_fail (data != NULL, FALSE);
 	
 	priv = dbe->priv;
-	DEBUG_PRINT ("thread monitor");
+/*	DEBUG_PRINT ("thread monitor");*/
 		
 	if (priv->concurrent_threads > THREADS_MAX_CONCURRENT) {
 		/* monitor acted here. There are plenty threads already working. */
@@ -1205,6 +1200,7 @@
 		DEBUG_PRINT ("creating anjuta_launcher");
 		priv->ctags_launcher = anjuta_launcher_new ();
 
+		anjuta_launcher_disable_password_check (priv->ctags_launcher, TRUE);
 		g_signal_connect (G_OBJECT (priv->ctags_launcher), "child-exited",
 						  G_CALLBACK (on_scan_files_end_1), NULL);
 
@@ -1353,7 +1349,8 @@
 	sdbe->priv->sym_type_conversion_hash =
 		g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);	
 	h = sdbe->priv->sym_type_conversion_hash;
-	
+
+	/* 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);
 
@@ -1624,6 +1621,48 @@
 	return sdbe;
 }
 
+/**
+ * Set some default parameters to use with the current database.
+ */
+static void
+sdb_engine_set_defaults_db_parameters (SymbolDBEngine * dbe)
+{
+	GdaCommand *command;
+	SymbolDBEnginePriv *priv;
+	priv = dbe->priv;
+
+	command = gda_command_new ("PRAGMA page_size = 32768", GDA_COMMAND_TYPE_SQL,
+							   GDA_COMMAND_OPTION_STOP_ON_ERRORS);
+	gda_connection_execute_non_select_command (priv->db_connection,
+											   command, NULL, NULL);
+	gda_command_free (command);
+	
+	command = gda_command_new ("PRAGMA cache_size = 12288", GDA_COMMAND_TYPE_SQL,
+							   GDA_COMMAND_OPTION_STOP_ON_ERRORS);
+	gda_connection_execute_non_select_command (priv->db_connection,
+											   command, NULL, NULL);
+	gda_command_free (command);
+
+	command = gda_command_new ("PRAGMA synchronous = OFF", GDA_COMMAND_TYPE_SQL,
+							   GDA_COMMAND_OPTION_STOP_ON_ERRORS);
+	gda_connection_execute_non_select_command (priv->db_connection,
+											   command, NULL, NULL);
+	gda_command_free (command);
+	
+	command = gda_command_new ("PRAGMA temp_store = MEMORY", GDA_COMMAND_TYPE_SQL,
+							   GDA_COMMAND_OPTION_STOP_ON_ERRORS);
+	gda_connection_execute_non_select_command (priv->db_connection,
+											   command, NULL, NULL);
+	gda_command_free (command);
+	
+	command = gda_command_new ("PRAGMA case_sensitive_like = 1", GDA_COMMAND_TYPE_SQL,
+							   GDA_COMMAND_OPTION_STOP_ON_ERRORS);
+	gda_connection_execute_non_select_command (priv->db_connection,
+											   command, NULL, NULL);
+	gda_command_free (command);
+	
+}
+
 /* Will create priv->db_connection, priv->gda_client.
  * Connect to database identified by data_source.
  * Usually data_source is defined also into priv. We let it here as parameter 
@@ -1795,6 +1834,8 @@
 		sdb_engine_create_db_tables (dbe, TABLES_SQL);
 	}
 
+	sdb_engine_set_defaults_db_parameters (dbe);
+	
 	return TRUE;
 }
 
@@ -2528,40 +2569,7 @@
 	gda_value_free (value);
 
 	return TRUE;
-}
-
-
-static void
-sdb_engine_prepare_executing_commands (SymbolDBEngine *dbe)
-{
-	GdaCommand *command;
-	SymbolDBEnginePriv *priv;
-	priv = dbe->priv;
-
-	command = gda_command_new ("PRAGMA page_size = 32768", GDA_COMMAND_TYPE_SQL,
-							   GDA_COMMAND_OPTION_STOP_ON_ERRORS);
-	gda_connection_execute_non_select_command (priv->db_connection,
-											   command, NULL, NULL);
-	gda_command_free (command);
-	
-	command = gda_command_new ("PRAGMA cache_size = 12288", GDA_COMMAND_TYPE_SQL,
-							   GDA_COMMAND_OPTION_STOP_ON_ERRORS);
-	gda_connection_execute_non_select_command (priv->db_connection,
-											   command, NULL, NULL);
-	gda_command_free (command);
-
-	command = gda_command_new ("PRAGMA synchronous = OFF", GDA_COMMAND_TYPE_SQL,
-							   GDA_COMMAND_OPTION_STOP_ON_ERRORS);
-	gda_connection_execute_non_select_command (priv->db_connection,
-											   command, NULL, NULL);
-	gda_command_free (command);
-	
-	command = gda_command_new ("PRAGMA temp_store = MEMORY", GDA_COMMAND_TYPE_SQL,
-							   GDA_COMMAND_OPTION_STOP_ON_ERRORS);
-	gda_connection_execute_non_select_command (priv->db_connection,
-											   command, NULL, NULL);
-	gda_command_free (command);
-}
+} 
 
 gboolean
 symbol_db_engine_add_new_files (SymbolDBEngine * dbe, const gchar * project,
@@ -2578,10 +2586,6 @@
 	g_return_val_if_fail (priv->db_connection != NULL, FALSE);
 	g_return_val_if_fail (project != NULL, FALSE);
 
-	/* FIXME try this... to see if things speed up*/
-	sdb_engine_prepare_executing_commands (dbe);
-	
-	
 	if (symbol_db_engine_is_project_opened (dbe, project) == FALSE) 
 	{
 		g_warning ("your project isn't opened, %s (priv %s)", project, 
@@ -4733,6 +4737,124 @@
 	return priv->sym_type_conversion_hash;
 }
 
+GPtrArray *
+symbol_db_engine_fill_type_array (IAnjutaSymbolType match_types)
+{
+	GPtrArray *filter_array;
+	filter_array = g_ptr_array_new ();
+
+	if (match_types & IANJUTA_SYMBOL_TYPE_CLASS)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("class"));
+	}
+
+	if (match_types & IANJUTA_SYMBOL_TYPE_ENUM)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("enum"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_ENUMERATOR)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("enumerator"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_FIELD)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("field"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_FUNCTION)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("function"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_INTERFACE)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("interface"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_MEMBER)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("member"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_METHOD)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("method"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_NAMESPACE)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("namespace"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_PACKAGE)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("package"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_PROTOTYPE)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("prototype"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_STRUCT)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("struct"));
+	}
+
+	if (match_types & IANJUTA_SYMBOL_TYPE_TYPEDEF)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("typedef"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_STRUCT)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("struct"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_UNION)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("union"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_VARIABLE)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("variable"));
+	}
+				
+	if (match_types & IANJUTA_SYMBOL_TYPE_EXTERNVAR)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("externvar"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_MACRO)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("macro"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_MACRO_WITH_ARG)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("macro_with_arg"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_FILE)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("file"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_VARIABLE)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("variable"));
+	}
+	
+	if (match_types & IANJUTA_SYMBOL_TYPE_OTHER)
+	{
+		g_ptr_array_add (filter_array, g_strdup ("other"));
+	}
+
+	return filter_array;
+}
 
 /**
  * Update symbols of saved files. 
@@ -5291,78 +5413,10 @@
 	return final_definition_id;
 }
 
-/* Returns an iterator to the data retrieved from database. 
- * The iterator, if not null, will contain a list of parent classes for the given 
- * symbol name.
- * namespace_name can be NULL.
- */
-SymbolDBEngineIterator *
-symbol_db_engine_get_class_parents (SymbolDBEngine *dbe, const gchar *klass_name, 
-									 const GPtrArray *scope_path)
-{
-	SymbolDBEnginePriv *priv;
-	gchar *query_str;
-	GdaDataModel *data;
-	gint final_definition_id;
-	
-	g_return_val_if_fail (dbe != NULL, FALSE);
-	priv = dbe->priv;
-
-	if (priv->mutex)
-		g_mutex_lock (priv->mutex);
-	
-	final_definition_id = -1;
-	if (scope_path != NULL)	
-		final_definition_id = sdb_engine_walk_down_scope_path (dbe, scope_path);
-		
-	/* FIXME: as always prepared queries of this complexity gives 
-		GDA_QUERY_TYPE_NON_PARSED_SQL error. */
-	if (final_definition_id > 0)
-	{		
-		query_str = g_strdup_printf("SELECT symbol.symbol_id, symbol.name FROM heritage "
-			"JOIN symbol ON heritage.symbol_id_base = symbol.symbol_id "
-			"WHERE symbol_id_derived = ("
-				"SELECT symbol_id FROM symbol "
-					"JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id "
-					"WHERE symbol.name = '%s' "
-						"AND sym_kind.kind_name = 'class' "
-						"AND symbol.scope_id = '%d'"
-				")", klass_name, final_definition_id);
-	}
-	else 
-	{
-		query_str = g_strdup_printf("SELECT symbol.symbol_id, symbol.name FROM heritage "
-			"JOIN symbol ON heritage.symbol_id_base = symbol.symbol_id "
-			"WHERE symbol_id_derived = ("
-				"SELECT symbol_id FROM symbol "
-					"JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id "
-					"WHERE symbol.name = '%s' "
-						"AND sym_kind.kind_name = 'class' "
-				")", klass_name);
-	}
-	
-	DEBUG_PRINT ("get parents query: %s", query_str);
-
-	if ( (data = sdb_engine_execute_select_sql (dbe, query_str)) == NULL ||
-		  gda_data_model_get_n_rows (data) <= 0 ) 
-	{
-		g_free (query_str);
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
-		return NULL;			  
-	}
-
-	g_free (query_str);
-
-	if (priv->mutex)
-		g_mutex_unlock (priv->mutex);
-	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);
-}
 
 static inline void
 sdb_engine_prepare_symbol_info_sql (SymbolDBEngine *dbe, GString *info_data,
-									GString *join_data, gint sym_info) 
+									GString *join_data, SymExtraInfo sym_info) 
 {
 	if (sym_info & SYMINFO_FILE_PATH 	|| 
 		sym_info & SYMINFO_LANGUAGE  	||
@@ -5448,12 +5502,160 @@
 */
 }
 
+
+/**
+ * Same behaviour as symbol_db_engine_get_class_parents () but this is quicker because
+ * of the child_klass_symbol_id, aka the derived class symbol_id.
+ * Return an iterator (eventually) containing the base classes.
+ */
+SymbolDBEngineIterator *
+symbol_db_engine_get_class_parents_by_symbol_id (SymbolDBEngine *dbe, 
+												 gint child_klass_symbol_id,
+												 SymExtraInfo sym_info)
+{
+	SymbolDBEnginePriv *priv;
+	gchar *query_str;
+	GdaDataModel *data;
+	GString *info_data;
+	GString *join_data;
+	
+	g_return_val_if_fail (dbe != NULL, FALSE);
+	priv = dbe->priv;
+
+	if (priv->mutex)
+		g_mutex_lock (priv->mutex);
+	
+	/* info_data contains the stuff after SELECT and befor FROM */
+	info_data = g_string_new ("");
+	
+	/* join_data contains the optionals joins to do to retrieve new data on other
+	 * tables.
+	 */
+	join_data = g_string_new ("");
+
+	/* fill info_data and join data with optional sql */
+	sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
+	
+	query_str = g_strdup_printf("SELECT symbol.symbol_id, "
+			"symbol.name, symbol.file_position, symbol.is_file_scope, "
+			"symbol.signature %s FROM heritage "
+			"JOIN symbol ON heritage.symbol_id_base = symbol.symbol_id %s "
+			"WHERE heritage.symbol_id_derived = %d", info_data->str, 
+								join_data->str, child_klass_symbol_id);
+	
+	DEBUG_PRINT ("symbol_db_engine_get_class_parents_by_symbol_id query: %s", query_str);
+
+	if ( (data = sdb_engine_execute_select_sql (dbe, query_str)) == NULL ||
+		  gda_data_model_get_n_rows (data) <= 0 ) 
+	{
+		g_free (query_str);
+		if (priv->mutex)
+			g_mutex_unlock (priv->mutex);
+		return NULL;
+	}
+
+	g_free (query_str);
+
+	if (priv->mutex)
+		g_mutex_unlock (priv->mutex);
+	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
+												priv->sym_type_conversion_hash);	
+}
+
+
+/** 
+ * Returns an iterator to the data retrieved from database. 
+ * The iterator, if not null, will contain a list of parent classes for the given 
+ * symbol name.
+ * scope_path can be NULL.
+ */
+SymbolDBEngineIterator *
+symbol_db_engine_get_class_parents (SymbolDBEngine *dbe, const gchar *klass_name, 
+									 const GPtrArray *scope_path, SymExtraInfo sym_info)
+{
+	SymbolDBEnginePriv *priv;
+	gchar *query_str;
+	GdaDataModel *data;
+	GString *info_data;
+	GString *join_data;
+	gint final_definition_id;
+	
+	g_return_val_if_fail (dbe != NULL, FALSE);
+	priv = dbe->priv;
+
+	if (priv->mutex)
+		g_mutex_lock (priv->mutex);
+	
+	final_definition_id = -1;
+	if (scope_path != NULL)	
+		final_definition_id = sdb_engine_walk_down_scope_path (dbe, scope_path);
+
+	/* info_data contains the stuff after SELECT and befor FROM */
+	info_data = g_string_new ("");
+	
+	/* join_data contains the optionals joins to do to retrieve new data on other
+	 * tables.
+	 */
+	join_data = g_string_new ("");
+
+	/* fill info_data and join data with optional sql */
+	sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
+	
+	/* FIXME: as always prepared queries of this complexity gives 
+		GDA_QUERY_TYPE_NON_PARSED_SQL error. */
+	if (final_definition_id > 0)
+	{		
+		query_str = g_strdup_printf("SELECT symbol.symbol_id, "
+			"symbol.name, symbol.file_position, symbol.is_file_scope, "
+			"symbol.signature %s FROM heritage "
+			"JOIN symbol ON heritage.symbol_id_base = symbol.symbol_id %s "
+			"WHERE symbol_id_derived = ("
+				"SELECT symbol_id FROM symbol "
+					"JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id "
+					"WHERE symbol.name = '%s' "
+						"AND sym_kind.kind_name = 'class' "
+						"AND symbol.scope_id = '%d'"
+				")", info_data->str, join_data->str, klass_name, final_definition_id);
+	}
+	else 
+	{
+		query_str = g_strdup_printf("SELECT symbol.symbol_id, symbol.name, "
+			"symbol.file_position, symbol.is_file_scope, "
+			"symbol.signature %s FROM heritage "
+			"JOIN symbol ON heritage.symbol_id_base = symbol.symbol_id %s "
+			"WHERE symbol_id_derived = ("
+				"SELECT symbol_id FROM symbol "
+					"JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id "
+					"WHERE symbol.name = '%s' "
+						"AND sym_kind.kind_name = 'class' "
+				")", info_data->str, join_data->str, klass_name);
+	}
+	
+	DEBUG_PRINT ("get parents query: %s", query_str);
+
+	if ( (data = sdb_engine_execute_select_sql (dbe, query_str)) == NULL ||
+		  gda_data_model_get_n_rows (data) <= 0 ) 
+	{
+		g_free (query_str);
+		if (priv->mutex)
+			g_mutex_unlock (priv->mutex);
+		return NULL;
+	}
+
+	g_free (query_str);
+
+	if (priv->mutex)
+		g_mutex_unlock (priv->mutex);
+	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
+												priv->sym_type_conversion_hash);
+}
+
 SymbolDBEngineIterator *
 symbol_db_engine_get_global_members_filtered (SymbolDBEngine *dbe, 
 									const GPtrArray *filter_kinds,
 									gboolean include_kinds, gboolean group_them,
 									gint results_limit, gint results_offset,
-								 	gint sym_info)
+								 	SymExtraInfo sym_info)
 {
 	SymbolDBEnginePriv *priv;
 	GdaDataModel *data;
@@ -5623,11 +5825,11 @@
 SymbolDBEngineIterator *
 symbol_db_engine_get_scope_members_by_symbol_id_filtered (SymbolDBEngine *dbe, 
 									gint scope_parent_symbol_id, 
+									const GPtrArray *filter_kinds,
+									gboolean include_kinds,														  
 									gint results_limit,
 									gint results_offset,
-									gint sym_info,
-									const GPtrArray *filter_kinds,
-									gboolean include_kinds)
+									SymExtraInfo sym_info)
 {
 	SymbolDBEnginePriv *priv;
 	gchar *query_str;	
@@ -5763,7 +5965,7 @@
 									gint scope_parent_symbol_id, 
 									gint results_limit,
 									gint results_offset,
-									gint sym_info)
+									SymExtraInfo sym_info)
 {
 /*
 select b.* from symbol a, symbol b where a.symbol_id = 348 and 
@@ -5859,7 +6061,7 @@
  */
 SymbolDBEngineIterator *
 symbol_db_engine_get_scope_members (SymbolDBEngine *dbe, 
-									const GPtrArray* scope_path, gint sym_info)
+									const GPtrArray* scope_path, SymExtraInfo sym_info)
 {
 /*
 simple scope 
@@ -5999,7 +6201,7 @@
  */
 SymbolDBEngineIterator *
 symbol_db_engine_get_file_symbols (SymbolDBEngine *dbe, 
-									const gchar *file_path, gint sym_info)
+									const gchar *file_path, SymExtraInfo sym_info)
 {
 	SymbolDBEnginePriv *priv;
 	gchar *query_str;	
@@ -6064,7 +6266,7 @@
 
 SymbolDBEngineIterator *
 symbol_db_engine_get_symbol_info_by_id (SymbolDBEngine *dbe, 
-									gint sym_id, gint sym_info)
+									gint sym_id, SymExtraInfo sym_info)
 {
 	SymbolDBEnginePriv *priv;
 	gchar *query_str;	
@@ -6155,9 +6357,14 @@
 }
 
 
+/**
+ * Use this function to find symbols names by patterns like '%foo_func%'
+ * that will return a family of my_foo_func_1, your_foo_func_2 etc
+ * @name must not be NULL.
+ */
 SymbolDBEngineIterator *
 symbol_db_engine_find_symbol_by_name_pattern (SymbolDBEngine *dbe, 
-									const gchar *name, gint sym_info)
+									const gchar *name, SymExtraInfo sym_info)
 {
 	SymbolDBEnginePriv *priv;
 	gchar *query_str;	
@@ -6190,8 +6397,8 @@
 	
 /*	DEBUG_PRINT ("DYNAMIC query is %s", query_str);*/
 
-	if ( (data = sdb_engine_execute_select_sql (dbe, query_str)) == NULL ||
-		  gda_data_model_get_n_rows (data) <= 0 ) 
+	if ((data = sdb_engine_execute_select_sql (dbe, query_str)) == NULL ||
+		  gda_data_model_get_n_rows (data) <= 0)
 	{
 		g_free (query_str);
 		if (priv->mutex)
@@ -6242,7 +6449,7 @@
 				"symbol.file_position, symbol.scope_definition_id, symbol.scope_id "
 				"FROM symbol "
 				"WHERE symbol.scope_definition_id = ( "
-				"SELECT symbol.scope_id FROM symbol WHERE symbol.symbol_id = '%d') "
+				"SELECT symbol.scope_id FROM symbol WHERE symbol.symbol_id = %d) "
 					"AND symbol.scope_definition_id > 0", 
 									 scoped_symbol_id);
 	}
@@ -6253,9 +6460,9 @@
 				"FROM symbol JOIN file "
 				"ON symbol.file_defined_id = file.file_id "
 					"WHERE symbol.scope_definition_id = ( "
-					"SELECT symbol.scope_id FROM symbol WHERE symbol.symbol_id = '%d') "
+					"SELECT symbol.scope_id FROM symbol WHERE symbol.symbol_id = %d) "
 						"AND symbol.scope_definition_id > 0 "
-						"AND file.file_path = '%s' ",
+						"AND file.file_path = '%s'",
 						scoped_symbol_id,
 						db_file);
 	}
@@ -6444,4 +6651,146 @@
 	return res;
 }
 
+/**
+ * @param pattern Pattern you want to search for. If NULL it will use '%' and LIKE for query.
+ * @param exact_match Should the pattern searched for an exact match?
+ * @param filter_kinds Can be NULL. In that case these filters will be taken into consideration.
+ * @param include_kinds Should the filter_kinds (if not null) be applied as inluded or excluded?
+ * @param global_search If TRUE only global public function will be searched. If false
+ *		  even private or static (for C language) will be searched.
+ * @param sym_info Infos about symbols you want to know.
+ */
+SymbolDBEngineIterator *
+symbol_db_engine_find_symbol_by_name_pattern_filtered (SymbolDBEngine *dbe, 
+									const gchar *pattern, 
+									gboolean exact_match,
+									const GPtrArray *filter_kinds,
+									gboolean include_kinds,
+									gboolean global_search,
+									SymExtraInfo sym_info)
+{
+	SymbolDBEnginePriv *priv;
+	GdaDataModel *data;
+	GString *info_data;
+	GString *join_data;
+	GString *filter_str;
+	gchar *query_str;
+	gchar *match_str;
+
+	g_return_val_if_fail (dbe != NULL, NULL);
+	priv = dbe->priv;
+
+	if (priv->mutex)
+		g_mutex_lock (priv->mutex);
+	
+	/* info_data contains the stuff after SELECT and befor FROM */
+	info_data = g_string_new ("");
+	
+	/* join_data contains the optionals joins to do to retrieve new data on other
+	 * tables.
+	 */
+	join_data = g_string_new ("");
+
+	sym_info = sym_info & ~SYMINFO_KIND;
+	
+	/* fill info_data and join data with optional sql */
+	sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
+
+	/* check for a null pattern. If NULL we'll set a patter like '%' 
+	 * and exact_match = FALSE . In this way will match everything.
+	 */
+	if (pattern == NULL)
+	{
+		pattern = "%";
+		exact_match = FALSE;
+	}
+	
+	/* check for match */
+	if (exact_match == TRUE)
+	{
+		match_str = g_strdup_printf (" = '%s'", pattern);
+	}
+	else
+	{
+		match_str = g_strdup_printf (" LIKE '%%%s%%'", pattern);
+	}
+	
+	if (filter_kinds == NULL) 
+	{
+		query_str = g_strdup_printf ("SELECT symbol.symbol_id, "
+			"symbol.name, symbol.file_position, symbol.is_file_scope, "
+			"symbol.signature %s FROM symbol %s "
+				"WHERE symbol.name %s AND symbol.is_file_scope = %d", 
+				info_data->str, join_data->str, match_str, !global_search);
+	}
+	else
+	{
+		filter_str = g_string_new ("");
+		/* build filter string */
+		if (filter_kinds->len > 0)
+		{
+			gint i;
+			if (include_kinds == TRUE)
+			{
+				filter_str = g_string_append (filter_str , "AND sym_kind.kind_name IN ('");
+			}
+			else
+			{
+				filter_str = g_string_append (filter_str , "AND sym_kind.kind_name NOT IN ('");
+			}
+
+			filter_str = g_string_append (filter_str , 
+								  g_ptr_array_index (filter_kinds, 0));
+			filter_str = g_string_append (filter_str , "'");
+		
+			for (i = 1; i < filter_kinds->len; i++)
+			{
+				filter_str = g_string_append (filter_str, ", '");
+				filter_str = g_string_append (filter_str, 
+									  g_ptr_array_index (filter_kinds, i));
+				filter_str = g_string_append (filter_str, "'");
+			}
+			filter_str = g_string_append (filter_str, ")");		
+		}
 
+		/*
+		"symbol.is_file_scope, symbol.signature, sym_kind.kind_name %s "
+		"FROM symbol a, symbol symbol "
+		"%s JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id "
+		"WHERE a.symbol_id = '%d' AND symbol.scope_id = a.scope_definition_id "
+*/		
+		query_str = g_strdup_printf ("SELECT symbol.symbol_id, symbol.name, "
+			"symbol.file_position, symbol.is_file_scope, symbol.signature, "
+			"sym_kind.kind_name "
+				"%s FROM symbol %s JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id "
+				"WHERE symbol.name %s AND symbol.is_file_scope = %d %s GROUP BY symbol.name", 
+				 info_data->str, join_data->str, match_str, 
+				 !global_search, filter_str->str);
+		g_string_free (filter_str, FALSE);
+	}
+	
+	DEBUG_PRINT ("symbol_db_engine_find_symbol_by_name_pattern_filtered query is %s", 
+				 query_str);
+	
+	if ( (data = sdb_engine_execute_select_sql (dbe, query_str)) == NULL ||
+	  	gda_data_model_get_n_rows (data) <= 0 ) 
+	{
+		g_free (query_str);
+		g_string_free (info_data, FALSE);
+		g_string_free (join_data, FALSE);
+		if (priv->mutex)
+			g_mutex_unlock (priv->mutex);
+		return NULL;
+	}
+
+	g_free (query_str);
+	g_string_free (info_data, FALSE);
+	g_string_free (join_data, FALSE);
+	
+	g_free (match_str);
+	
+	if (priv->mutex)
+		g_mutex_unlock (priv->mutex);
+	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
+												priv->sym_type_conversion_hash);	
+}

Modified: branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.h
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.h	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.h	Thu Jan 31 18:36:39 2008
@@ -27,7 +27,7 @@
 
 #include <glib-object.h>
 #include <glib.h>
-
+#include <libanjuta/interfaces/ianjuta-symbol.h>
 #include "symbol-db-engine-iterator.h"
 
 G_BEGIN_DECLS
@@ -221,13 +221,51 @@
 gboolean inline
 symbol_db_engine_is_project_opened (SymbolDBEngine *dbe, const gchar* project_name);
 
+/** 
+ * Hash table that converts from a char like 'class' 'struct' etc to an 
+ * IANJUTA_SYMBOL_TYPE
+ */
+const GHashTable*
+symbol_db_engine_get_sym_type_conversion_hash (SymbolDBEngine *dbe);
+
 /**
- * Return an iterator to the data retrieved from database. 
- * It will be possible to get the scope specified by the line of the file. 
+ * Return a GPtrArray that must be freed from caller.
+ */
+GPtrArray *
+symbol_db_engine_fill_type_array (IAnjutaSymbolType match_types);
+
+
+/**********************
+ * ITERATABLE QUERIES
+ **********************/
+
+/**
+ * Use this function to find symbols names by patterns like '%foo_func%'
+ * that will return a family of my_foo_func_1, your_foo_func_2 etc
+ * @name must not be NULL.
  */
 SymbolDBEngineIterator *
-symbol_db_engine_get_current_scope (SymbolDBEngine *dbe, 
-									const gchar* filename, gulong line);
+symbol_db_engine_find_symbol_by_name_pattern (SymbolDBEngine *dbe, 
+									const gchar *name, SymExtraInfo sym_info);
+
+/**
+ * @param pattern Pattern you want to search for. If NULL it will use '%' and LIKE for query.
+ * @param exact_match Should the pattern searched for an exact match?
+ * @param filter_kinds Can be NULL. In that case these filters will be taken into consideration.
+ * @param include_kinds Should the filter_kinds (if not null) be applied as inluded or excluded?
+ * @param global_search If TRUE only global public function will be searched. If false
+ *		  even private or static (for C language) will be searched.
+ * @param sym_info Infos about symbols you want to know.
+ */
+SymbolDBEngineIterator *
+symbol_db_engine_find_symbol_by_name_pattern_filtered (SymbolDBEngine *dbe, 
+									const gchar *pattern, 
+									gboolean exact_match,
+									const GPtrArray *filter_kinds,
+									gboolean include_kinds,
+									gboolean global_search,
+									SymExtraInfo sym_info);
+
 
 /**
  * Return an iterator to the data retrieved from database. 
@@ -236,39 +274,61 @@
  */
 SymbolDBEngineIterator *
 symbol_db_engine_get_class_parents (SymbolDBEngine *dbe, const gchar *klass_name, 
-									 const GPtrArray *scope_path);
+									 const GPtrArray *scope_path, SymExtraInfo sym_info);
 
+/**
+ * Use this function to get parent symbols of a given class.
+ */
+SymbolDBEngineIterator *
+symbol_db_engine_get_class_parents_by_symbol_id (SymbolDBEngine *dbe, 
+												 gint child_klass_symbol_id,
+												 SymExtraInfo sym_info);
 
 /**
+ * Return an iterator to the data retrieved from database. 
+ * It will be possible to get the scope specified by the line of the file. 
+ */
+SymbolDBEngineIterator *
+symbol_db_engine_get_current_scope (SymbolDBEngine *dbe, 
+									const gchar* filename, gulong line);
+
+
+/**
+ * Use this function to get symbols of a file.
+ */
+SymbolDBEngineIterator *
+symbol_db_engine_get_file_symbols (SymbolDBEngine *dbe, 
+								   const gchar *file_path, 
+								   SymExtraInfo sym_info);
+
+/**
+ * Use this function to get global symbols only. I.e. private or file-only scoped symbols
+ * will NOT be returned.
  * @param filter_kinds Can be NULL. In that case we'll return all the kinds of symbols found
  * at root level [global level].
  * @param include_kinds Should we include in the result the filter_kinds or not?
  * @param group_them If TRUE then will be issued a 'group by symbol.name' option.
- * If FALSE you can have as result more symbols with the same name but different
- * symbols id. See for example more namespaces declared on different files.
+ * 		If FALSE you can have as result more symbols with the same name but different
+ * 		symbols id. See for example more namespaces declared on different files.
  */
 SymbolDBEngineIterator *
 symbol_db_engine_get_global_members_filtered (SymbolDBEngine *dbe, 
 									const GPtrArray *filter_kinds,
-									gboolean include_kinds, gboolean group_them,
-									gint results_limit, gint results_offset,
-								 	gint sym_info);
-
-SymbolDBEngineIterator *
-symbol_db_engine_get_file_symbols (SymbolDBEngine *dbe, 
-									const gchar *file_path, gint sym_info);
-
-SymbolDBEngineIterator *
-symbol_db_engine_get_symbol_info_by_id (SymbolDBEngine *dbe, 
-									gint sym_id, gint sym_info);
+									gboolean include_kinds, 
+									gboolean group_them,
+									gint results_limit, 
+									gint results_offset,
+								 	SymExtraInfo sym_info);
 
-/**
- * Use this function to find symbols names by patterns like '%foo_func%'
- * that will return a family of my_foo_func_1, your_foo_func_2 etc
+/** 
+ * No iterator for now. We need the quickest query possible.
+ * @param scoped_symbol_id Symbol you want to know the parent of.
+ * @param db_file db-relative filename path. eg. /src/foo.c
  */
-SymbolDBEngineIterator *
-symbol_db_engine_find_symbol_by_name_pattern (SymbolDBEngine *dbe, 
-									const gchar *name, gint sym_info);
+gint
+symbol_db_engine_get_parent_scope_id_by_symbol_id (SymbolDBEngine *dbe, 
+									gint scoped_symbol_id,
+									const gchar* db_file);
 
 /** scope_path cannot be NULL.
  * scope_path will be something like "scope1_kind", "scope1_name", "scope2_kind", 
@@ -276,7 +336,7 @@
  */
 SymbolDBEngineIterator *
 symbol_db_engine_get_scope_members (SymbolDBEngine *dbe, 
-									const GPtrArray* scope_path, gint sym_info);
+									const GPtrArray* scope_path, SymExtraInfo sym_info);
 
 /**
  * Sometimes it's useful going to query just with ids [and so integers] to have
@@ -287,29 +347,23 @@
 									gint scope_parent_symbol_id, 
 									gint results_limit,
 									gint results_offset,
-									gint sym_info);
+									SymExtraInfo sym_info);
 
 SymbolDBEngineIterator *
 symbol_db_engine_get_scope_members_by_symbol_id_filtered (SymbolDBEngine *dbe, 
 									gint scope_parent_symbol_id, 
+									const GPtrArray *filter_kinds,
+									gboolean include_kinds,														  
 									gint results_limit,
 									gint results_offset,
-									gint sym_info,
-									const GPtrArray *filter_kinds,
-									gboolean include_kinds);
+									SymExtraInfo sym_info);
 
-/** 
- * No iterator for now. We need the quickest query possible.
- * @param scoped_symbol_id Symbol you want to know the parent of.
- * @param db_file db-relative filename path. eg. /src/foo.c
+/**
+ * Use this function to get infos about a symbol.
  */
-gint
-symbol_db_engine_get_parent_scope_id_by_symbol_id (SymbolDBEngine *dbe, 
-									gint scoped_symbol_id,
-									const gchar* db_file);
-
-const GHashTable*
-symbol_db_engine_get_sym_type_conversion_hash (SymbolDBEngine *dbe);
+SymbolDBEngineIterator *
+symbol_db_engine_get_symbol_info_by_id (SymbolDBEngine *dbe, 
+									gint sym_id, SymExtraInfo sym_info);
 
 G_END_DECLS
 

Modified: branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-view-locals.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-view-locals.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-view-locals.c	Thu Jan 31 18:36:39 2008
@@ -62,6 +62,7 @@
 	GtkTreeStore *store;
 	GTree *nodes_displayed;
 	GTree *waiting_for;	
+	GQueue *symbols_inserted_ids;
 	
 } FileSymbolsStatus;
 
@@ -71,9 +72,11 @@
 	gint insert_handler;
 	gint remove_handler;	
 	gint scan_end_handler;
+	gint insertion_idle_handler;
 	
 	GTree *nodes_displayed;
 	GTree *waiting_for;	
+	GQueue *symbols_inserted_ids;
 
 	gboolean recv_signals;
 	GHashTable *files_view_status;
@@ -154,7 +157,6 @@
 	if (row_ref == NULL) 
 	{
 		/* no node displayed found */
-		DEBUG_PRINT ("sdb_view_locals_get_iter_from_row_ref (): row_ref == NULL");
 		return FALSE;
 	}
 			
@@ -172,7 +174,7 @@
 		gtk_tree_path_free (path);
 		return FALSE;
 	}
-	gtk_tree_path_free (path);	
+	gtk_tree_path_free (path);
 	
 	return TRUE;
 }
@@ -258,9 +260,11 @@
 	priv->current_local_file_path = NULL;
 	priv->nodes_displayed = NULL;
 	priv->waiting_for = NULL;
+	priv->symbols_inserted_ids = NULL;
 	priv->insert_handler = 0;
 	priv->scan_end_handler = 0;
 	priv->remove_handler = 0;
+	priv->insertion_idle_handler = 0;
 	priv->files_view_status = g_hash_table_new_full (g_str_hash, 
 								g_str_equal, g_free, (GDestroyNotify)file_view_status_destroy);
 
@@ -381,8 +385,7 @@
 	
 	store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));
  	
-	gtk_tree_store_append (store, &child_iter, NULL);
-			
+	gtk_tree_store_append (store, &child_iter, NULL);			
 	gtk_tree_store_set (store, &child_iter,
 		COLUMN_PIXBUF, pixbuf,
 		COLUMN_NAME, symbol_name,
@@ -540,108 +543,6 @@
 
 
 static void
-on_scan_end (SymbolDBEngine *dbe, gpointer data)
-{
-	SymbolDBViewLocals *dbvl;
-	SymbolDBViewLocalsPriv *priv;
-	gint waiting_for_size;
-	TraverseData tdata;
-
-	dbvl = SYMBOL_DB_VIEW_LOCALS (data);
-	g_return_if_fail (dbvl != NULL);	
-	priv = dbvl->priv;
-
-	DEBUG_PRINT ("locals on_scan_end ()");
-	/* ok, symbol parsing has ended, are we sure that all the waiting_for
-	 * objects have been checked?
-	 * If it's not the case then try to add it to the on the root of the gtktreeview
-	 * and to trigger the insertion.
-	 */
-	if (priv->waiting_for == NULL || 
-		(waiting_for_size = g_tree_nnodes (priv->waiting_for)) <= 0)
-		return;
-
-	/* we have something left. Search the parent_symbol_id [identified by the
-	 * waiting_for id]
-	 */
-	tdata.dbvl = dbvl;
-	tdata.dbe = dbe;
-
-	g_tree_foreach (priv->waiting_for, traverse_on_scan_end, &tdata);
-}
-
-static void
-do_recurse_subtree_and_remove (SymbolDBViewLocals *dbvl, 
-							   GtkTreeIter *parent_subtree_iter)
-{
-	gint curr_symbol_id;
-	const GdkPixbuf *curr_pixbuf;
-	GtkTreeStore *store;
-	gchar *curr_symbol_name;
-
-	SymbolDBViewLocalsPriv *priv;
-	
-	g_return_if_fail (dbvl != NULL);
-	
-	priv = dbvl->priv;
-	store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));	
-	
-	gtk_tree_model_get (GTK_TREE_MODEL (store), parent_subtree_iter,
-				COLUMN_SYMBOL_ID, &curr_symbol_id,
-			    COLUMN_PIXBUF, &curr_pixbuf, 
-				COLUMN_NAME, &curr_symbol_name,	/* no strdup required */
-				-1);
-	
-	/*DEBUG_PRINT ("do_recurse_subtree_and_remove (): curr_symbol_id %d", 
-				 curr_symbol_id);*/
-				 
-	while (gtk_tree_model_iter_has_child  (GTK_TREE_MODEL (store), parent_subtree_iter)) 
-	{
-		GtkTreeIter child;
-		gtk_tree_model_iter_children (GTK_TREE_MODEL (store), &child, parent_subtree_iter);
-		
-		/* recurse */
-		do_recurse_subtree_and_remove (dbvl, &child);
-	}
-
-	gtk_tree_store_remove (store, parent_subtree_iter);
-	g_tree_remove (priv->nodes_displayed, (gpointer) curr_symbol_id);
-
-	/* don't forget to free this gchar */				   
-	g_free (curr_symbol_name);
-}
-
-
-static void 
-on_symbol_removed (SymbolDBEngine *dbe, gint symbol_id, gpointer data)
-{
-	GtkTreeStore *store;
-	SymbolDBViewLocals *dbvl;
-	SymbolDBViewLocalsPriv *priv;
-    GtkTreeIter  iter;	
-	GtkTreeRowReference *row_ref;
-	
-	dbvl = SYMBOL_DB_VIEW_LOCALS (data);
-
-	g_return_if_fail (dbvl != NULL);
-	priv = dbvl->priv;
-
-	store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));		
-
-	DEBUG_PRINT ("on_symbol_removed (): -local- %d", symbol_id);
-
-	row_ref = g_tree_lookup (priv->nodes_displayed, (gpointer)symbol_id);
-	if (sdb_view_locals_get_iter_from_row_ref (dbvl, row_ref, &iter) == FALSE)
-	{
-		g_warning ("on_symbol_removed locals: something went wrong");
-		return;
-	}
-
-	do_recurse_subtree_and_remove (dbvl, &iter);
-}
-
-
-static void
 add_waiting_for_symbol_to_view (SymbolDBViewLocals *dbvl, WaitingForSymbol *wfs,
 								gint parent_symbol_id)
 {
@@ -895,23 +796,84 @@
 	}
 }
 
-static void 
-on_symbol_inserted (SymbolDBEngine *dbe, gint symbol_id, gpointer data)
+static void
+consume_symbols_inserted_queue_idle_destroy (gpointer data)
 {
-	SymbolDBEngineIterator *iterator;
-	GtkTreeStore *store;
+	TraverseData *tdata;
 	SymbolDBViewLocals *dbvl;
+	SymbolDBEngine *dbe;
 	SymbolDBViewLocalsPriv *priv;
+	gint waiting_for_size;
+	
+	tdata = (TraverseData *)data;
+
+	dbvl = tdata->dbvl;
+	dbe = tdata->dbe;	
+	g_return_if_fail (dbvl != NULL);
+	priv = dbvl->priv;
+	
+	tdata = (TraverseData *)data;
+
+	DEBUG_PRINT ("consume_symbols_inserted_queue_idle_destroy");
+	priv->insertion_idle_handler = 0;
+
+	if (g_queue_get_length (priv->symbols_inserted_ids) <= 0)
+	{
+		/* ok, symbol parsing has ended, are we sure that all the waiting_for
+	 	 * objects have been checked?
+	 	 * If it's not the case then try to add it to the on the root of the gtktreeview
+	 	 * and to trigger the insertion.
+	 	 */
+		if (priv->waiting_for == NULL || 
+			(waiting_for_size = g_tree_nnodes (priv->waiting_for)) <= 0)
+			return;
+
+		/* we have something left. Search the parent_symbol_id [identified by the
+	 	 * waiting_for id]
+	 	 */
+		DEBUG_PRINT ("destroying tdata");
+		g_tree_foreach (priv->waiting_for, traverse_on_scan_end, tdata);
+	}
+
+	g_free (tdata);
+}
+
+static gboolean
+consume_symbols_inserted_queue_idle (gpointer data)
+{
+	TraverseData *tdata;
+	SymbolDBViewLocals *dbvl;
+	SymbolDBEngine *dbe;
+	SymbolDBViewLocalsPriv *priv;
+	SymbolDBEngineIterator *iterator;
+	GtkTreeStore *store;
+	gint consumed_symbol_id;
+	gint queue_length;
 	
 	/* it's not obligatory referred to a class inheritance */
 	gint parent_symbol_id;
 	
-	dbvl = SYMBOL_DB_VIEW_LOCALS (data);
+	tdata = (TraverseData *)data;
 
-	g_return_if_fail (dbvl != NULL);	
-	priv = dbvl->priv;	
+	dbvl = tdata->dbvl;
+	dbe = tdata->dbe;	
+	g_return_val_if_fail (dbvl != NULL, FALSE);
+	priv = dbvl->priv;
+	
+	
+	queue_length = g_queue_get_length (priv->symbols_inserted_ids);
+	
+/*	DEBUG_PRINT ("consume_symbols_inserted_queue_idle [remaining %d]", queue_length);*/
+	
+	/* consume a symbol */
+	if (queue_length > 0)
+	{
+		consumed_symbol_id = (gint) g_queue_pop_head (priv->symbols_inserted_ids);
+	}
+	else {
+		return FALSE;
+	}
 	
-/*	DEBUG_PRINT ("on_symbol_inserted (): -local- %d", symbol_id);*/
 	store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));
 	
 	/* again we use a little trick to insert symbols here. First of all forget chars
@@ -928,16 +890,16 @@
 	 *
 	 */
 	parent_symbol_id = symbol_db_engine_get_parent_scope_id_by_symbol_id (dbe, 
-															symbol_id,
+															consumed_symbol_id,
 															priv->current_db_file);
 	/* try in a global fashion */
 	if (parent_symbol_id <= 0)
 		parent_symbol_id = symbol_db_engine_get_parent_scope_id_by_symbol_id (dbe, 
-															symbol_id,
+															consumed_symbol_id,
 															NULL);
 		
 	/* get the original symbol infos */
-	iterator = symbol_db_engine_get_symbol_info_by_id (dbe, symbol_id, 
+	iterator = symbol_db_engine_get_symbol_info_by_id (dbe, consumed_symbol_id, 
 													   SYMINFO_SIMPLE |
 													   SYMINFO_ACCESS |
 													   SYMINFO_KIND);	
@@ -963,7 +925,7 @@
 		 */
 		SymbolDBEngineIterator *iterator_for_children;
 		iterator_for_children = 
-			symbol_db_engine_get_scope_members_by_symbol_id (dbe, symbol_id, -1,
+			symbol_db_engine_get_scope_members_by_symbol_id (dbe, consumed_symbol_id, -1,
 															 -1,
 															 SYMINFO_SIMPLE);
 		if (iterator_for_children == NULL) 
@@ -1002,19 +964,137 @@
 				}		
 				
 				/* put on waiting_for the subtree */
-				do_recurse_subtree_and_invalidate (dbvl, &child_iter, symbol_id);
+				do_recurse_subtree_and_invalidate (dbvl, &child_iter, consumed_symbol_id);
 			} while (symbol_db_engine_iterator_move_next (iterator_for_children) 
 					 == TRUE);
 			
 			g_object_unref (iterator_for_children);
 		}		
 		
-		prepare_for_adding (dbvl, parent_symbol_id, symbol_name, symbol_id, pixbuf);
+		prepare_for_adding (dbvl, parent_symbol_id, symbol_name, consumed_symbol_id, 
+							pixbuf);
 		
 		g_object_unref (iterator);
 	}	
 	
 	gtk_tree_view_expand_all (GTK_TREE_VIEW (dbvl));
+	
+	return TRUE;
+}
+
+static void
+on_scan_end (SymbolDBEngine *dbe, gpointer data)
+{
+	SymbolDBViewLocals *dbvl;
+	SymbolDBViewLocalsPriv *priv;
+	TraverseData *tdata;
+
+	dbvl = SYMBOL_DB_VIEW_LOCALS (data);
+	g_return_if_fail (dbvl != NULL);
+	priv = dbvl->priv;
+
+	tdata = g_new (TraverseData, 1);
+	tdata->dbvl = dbvl;
+	tdata->dbe = dbe;
+	
+	DEBUG_PRINT ("locals: on_scan_end");
+	if (priv->symbols_inserted_ids != NULL)
+	{
+		if (g_queue_get_length (priv->symbols_inserted_ids) > 0) 
+		{
+			/* reverswe the queue */
+			g_queue_reverse (priv->symbols_inserted_ids);
+			
+			priv->insertion_idle_handler = g_idle_add_full (G_PRIORITY_LOW, 
+						 (GSourceFunc) consume_symbols_inserted_queue_idle,
+						 (gpointer) tdata,
+						 (GDestroyNotify) consume_symbols_inserted_queue_idle_destroy);
+		}
+	}
+}
+
+static void
+do_recurse_subtree_and_remove (SymbolDBViewLocals *dbvl, 
+							   GtkTreeIter *parent_subtree_iter)
+{
+	gint curr_symbol_id;
+	const GdkPixbuf *curr_pixbuf;
+	GtkTreeStore *store;
+	gchar *curr_symbol_name;
+
+	SymbolDBViewLocalsPriv *priv;
+	
+	g_return_if_fail (dbvl != NULL);
+	
+	priv = dbvl->priv;
+	store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));	
+	
+	gtk_tree_model_get (GTK_TREE_MODEL (store), parent_subtree_iter,
+				COLUMN_SYMBOL_ID, &curr_symbol_id,
+			    COLUMN_PIXBUF, &curr_pixbuf, 
+				COLUMN_NAME, &curr_symbol_name,	/* no strdup required */
+				-1);
+	
+	/*DEBUG_PRINT ("do_recurse_subtree_and_remove (): curr_symbol_id %d", 
+				 curr_symbol_id);*/
+				 
+	while (gtk_tree_model_iter_has_child  (GTK_TREE_MODEL (store), parent_subtree_iter)) 
+	{
+		GtkTreeIter child;
+		gtk_tree_model_iter_children (GTK_TREE_MODEL (store), &child, parent_subtree_iter);
+		
+		/* recurse */
+		do_recurse_subtree_and_remove (dbvl, &child);
+	}
+
+	gtk_tree_store_remove (store, parent_subtree_iter);
+	g_tree_remove (priv->nodes_displayed, (gpointer) curr_symbol_id);
+
+	/* don't forget to free this gchar */				   
+	g_free (curr_symbol_name);
+}
+
+
+static void 
+on_symbol_removed (SymbolDBEngine *dbe, gint symbol_id, gpointer data)
+{
+	GtkTreeStore *store;
+	SymbolDBViewLocals *dbvl;
+	SymbolDBViewLocalsPriv *priv;
+    GtkTreeIter  iter;	
+	GtkTreeRowReference *row_ref;
+	
+	dbvl = SYMBOL_DB_VIEW_LOCALS (data);
+
+	g_return_if_fail (dbvl != NULL);
+	priv = dbvl->priv;
+
+	store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));		
+
+	DEBUG_PRINT ("on_symbol_removed (): -local- %d", symbol_id);
+
+	row_ref = g_tree_lookup (priv->nodes_displayed, (gpointer)symbol_id);
+	if (sdb_view_locals_get_iter_from_row_ref (dbvl, row_ref, &iter) == FALSE)
+	{
+		return;
+	}
+
+	do_recurse_subtree_and_remove (dbvl, &iter);
+}
+
+static void 
+on_symbol_inserted (SymbolDBEngine *dbe, gint symbol_id, gpointer data)
+{
+	SymbolDBViewLocals *dbvl;
+	SymbolDBViewLocalsPriv *priv;
+	
+	dbvl = SYMBOL_DB_VIEW_LOCALS (data);
+
+	g_return_if_fail (dbvl != NULL);	
+	priv = dbvl->priv;	
+	
+	/* save the symbol_id to be added in the queue and just return */
+	g_queue_push_head (priv->symbols_inserted_ids, (gpointer)symbol_id);
 }
 
 gint
@@ -1056,8 +1136,8 @@
 }								
 
 void
-symbol_db_view_locals_recv_signals_from_engine (SymbolDBViewLocals *dbvl, SymbolDBEngine *dbe,
-										 gboolean enable_status)
+symbol_db_view_locals_recv_signals_from_engine (SymbolDBViewLocals *dbvl, 
+							SymbolDBEngine *dbe, gboolean enable_status)
 {
 	SymbolDBViewLocalsPriv *priv;
 
@@ -1070,8 +1150,8 @@
 		/* connect some signals */
 		if (priv->insert_handler <= 0) 
 		{
-			priv->insert_handler = 	g_signal_connect (G_OBJECT (dbe), "symbol-inserted",
-						  G_CALLBACK (on_symbol_inserted), dbvl);
+			priv->insert_handler = 	g_signal_connect (G_OBJECT (dbe), 
+						"symbol-inserted", G_CALLBACK (on_symbol_inserted), dbvl);
 		}
 
 		if (priv->remove_handler <= 0)
@@ -1143,15 +1223,24 @@
 	if (priv->current_db_file != NULL)
 	{
 		FileSymbolsStatus *hash_node;
-		/* save current symbols status - e.g. gtktreestore, symbols_displayed etc */
+		/* save current symbols status - e.g. gtktreestore, symbols_displayed etc.,
+		 * if it hasn't already been done.
+		 */
 		hash_node = g_hash_table_lookup (priv->files_view_status, 
 										 priv->current_db_file);
 		
-		/* did we find something? yes? well, then we should save anything... */
+		/* did we find something? yes? well, then we should save nothing... */
 		if (hash_node == NULL)
 		{
 			/* found nothing? ok, save the status */
 			GtkTreeStore * store;
+		
+			/* remove the GSourceFunc, if it's running */
+			if (priv->insertion_idle_handler > 0)
+			{				
+				g_source_remove (priv->insertion_idle_handler);
+				priv->insertion_idle_handler = 0;
+			}
 			
 			store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));	
 			
@@ -1163,12 +1252,13 @@
 				fss->store = store;
 				fss->nodes_displayed = priv->nodes_displayed;
 				fss->waiting_for = priv->waiting_for;
+				fss->symbols_inserted_ids = priv->symbols_inserted_ids;
 				
 				DEBUG_PRINT ("symbol_db_view_locals_update_list (): g_hash_table_insert ");
 				/* insert it */
 				g_hash_table_insert (priv->files_view_status, 
 									 g_strdup (priv->current_db_file), fss);
-			}
+			}			
 		}
 	}
 	
@@ -1192,52 +1282,61 @@
 	
 	/* try to see if we had something saved before in the hash table */
 	fsstatus = g_hash_table_lookup (priv->files_view_status,
-									priv->current_db_file);
-	
+									priv->current_db_file);	
 
-	/* set the nodes_displayed */
 	if (fsstatus != NULL)
 	{
+		/* restore the previous saved status ... */
+		
+		/* set the nodes_displayed */
 		priv->nodes_displayed = fsstatus->nodes_displayed;
-	}
-	else 
-	{	
-		priv->nodes_displayed = g_tree_new_full ((GCompareDataFunc)&gtree_compare_func, 
-										 NULL,
-										 NULL,
-										 (GDestroyNotify)&gtk_tree_row_reference_free);
 		
-	}
-	
-	/* ... and the waiting_for */
-	if (fsstatus != NULL)
-	{
-		DEBUG_PRINT ("symbol_db_view_locals_update_list (): "
-					 "setting waiting_for to the saved one");
+		/* ... the waiting_for ... */
 		priv->waiting_for = fsstatus->waiting_for;
-	}
-	else 
-	{
-		priv->waiting_for = g_tree_new_full ((GCompareDataFunc)&gtree_compare_func, 
-										 NULL,
-										 NULL,
-										 NULL);
-	}
+	
+		/* ... the pending symbols_id to be inserted ... */
+		priv->symbols_inserted_ids = fsstatus->symbols_inserted_ids;
 
-	/* last but not the least the store */
-	if (fsstatus != NULL)
-	{
+		/* and last but not the least the store */
 		store = fsstatus->store;		
 
-		/* with tis set there's no need to re-retrieve the symbols from db,
+		/* with this set there's no need to re-retrieve the symbols from db,
 		 * speeding up the things.
 		 */
 		DEBUG_PRINT ("symbol_db_view_locals_update_list (): "
 					 "setting gtk_tree_view_set_model to the saved one");
 		gtk_tree_view_set_model (GTK_TREE_VIEW (dbvl), GTK_TREE_MODEL (store));
+		
+		
+		/* check if we left some ids on the queue. In case restart the idle_function */
+		if (g_queue_get_length (priv->symbols_inserted_ids) > 0)
+		{
+			TraverseData *tdata;
+			
+			tdata = g_new0 (TraverseData, 1);
+			tdata->dbvl = dbvl;
+			tdata->dbe = dbe;
+			
+			priv->insertion_idle_handler = g_idle_add_full (G_PRIORITY_LOW, 
+						 (GSourceFunc) consume_symbols_inserted_queue_idle,
+						 (gpointer) tdata,
+						 (GDestroyNotify) consume_symbols_inserted_queue_idle_destroy);			
+		}		
 	}
 	else 
-	{
+	{	
+		priv->nodes_displayed = g_tree_new_full ((GCompareDataFunc)&gtree_compare_func, 
+										 NULL,
+										 NULL,
+										 (GDestroyNotify)&gtk_tree_row_reference_free);		
+
+		priv->waiting_for = g_tree_new_full ((GCompareDataFunc)&gtree_compare_func, 
+										 NULL,
+										 NULL,
+										 NULL);
+		
+		priv->symbols_inserted_ids = g_queue_new ();
+
 		DEBUG_PRINT ("symbol_db_view_locals_update_list (): creating new store"); 
 		store = sdb_view_locals_create_new_store ();
 		gtk_tree_view_set_model (GTK_TREE_VIEW (dbvl), GTK_TREE_MODEL (store));
@@ -1247,7 +1346,7 @@
 		iterator = symbol_db_engine_get_file_symbols (dbe, filepath, SYMINFO_SIMPLE |
 												  	SYMINFO_ACCESS |
 													SYMINFO_KIND);		
-	
+	 	
 		if (iterator != NULL)
 		{
 			do {
@@ -1267,19 +1366,11 @@
 			g_object_unref (iterator);
 		}
 
-	/*	DEBUG_PRINT ("symbol_db_view_locals_update_list (): waiting for displaying: %d", 
-				 	g_tree_nnodes (priv->waiting_for));
-		DEBUG_PRINT ("symbol_db_view_locals_update_list (): already displayed: %d", 
-				 	g_tree_nnodes (priv->nodes_displayed));*/
-
 		/* ok, there may be some symbols left on the waiting_for_list...
  	 	* launch the callback function by hand, flushing the list it in case 
 	 	*/
-		on_scan_end (dbe, dbvl);
-		
+		on_scan_end (dbe, dbvl);		
 	}
-
-
 	
 	/* only gtk 2.12 ...
 	 * gtk_tree_view_set_show_expanders (GTK_TREE_VIEW (dbvl)); */

Modified: branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-view.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-view.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-view.c	Thu Jan 31 18:36:39 2008
@@ -103,7 +103,6 @@
 	if (row_ref == NULL) 
 	{
 		/* no node displayed found */
-		DEBUG_PRINT ("sdb_view_get_iter_from_row_ref (): row_ref == NULL");
 		return FALSE;
 	}
 			
@@ -515,6 +514,7 @@
 				}
 				else 
 				{
+					DEBUG_PRINT ("add_new_waiting_for (dbv, parent_symbol_id, symbol_name, symbol_id, ");
 					/* add it to the waiting_for trigger list */
 					add_new_waiting_for (dbv, parent_symbol_id, symbol_name, symbol_id, 
 										 pixbuf);
@@ -767,7 +767,6 @@
 	row_ref = g_tree_lookup (priv->nodes_displayed, (gpointer)symbol_id);
 	if (sdb_view_get_iter_from_row_ref (dbv, row_ref, &iter) == FALSE)
 	{
-		g_warning ("on_symbol_removed (): iter was not set ?![%d]", symbol_id);
 		return;
 	}
 	
@@ -821,7 +820,6 @@
 	NodeIdleExpand *node_expand;
 	SymbolDBView *dbv;
 	SymbolDBEngine *dbe;
-	SymbolDBEngineIterator *iterator;
 	
 	g_return_if_fail (data != NULL);
 	node_expand = data;	
@@ -978,13 +976,11 @@
 	/* get results from database */
 	iterator = symbol_db_engine_get_scope_members_by_symbol_id_filtered (dbe, 
 									expanded_symbol_id, 
+									filter_array,
+									TRUE,
 									-1,
 									-1,
-									SYMINFO_SIMPLE|
-									SYMINFO_KIND|
-									SYMINFO_ACCESS,
-									filter_array,
-									TRUE
+									SYMINFO_SIMPLE| SYMINFO_KIND| SYMINFO_ACCESS
 									);
 
 	g_ptr_array_free (filter_array, TRUE);
@@ -1077,7 +1073,7 @@
 						 (gpointer) node_expand,
 						 (GDestroyNotify) sdb_view_row_expanded_idle_destroy);
 		
-		/* insert the idle_id into a g_tree */
+		/* insert the idle_id into a g_tree for (eventually) a later retrieval */
 		DEBUG_PRINT ("Inserting into g_tree expanded_symbol_id %d and idle_id %d", 
 					 expanded_symbol_id, idle_id);
 		g_tree_insert (priv->expanding_gfunc_ids, (gpointer)expanded_symbol_id, 
@@ -1130,13 +1126,13 @@
 	{
 		iterator = symbol_db_engine_get_scope_members_by_symbol_id_filtered (dbe, 
 									positive_symbol_expanded, 
+									filter_array,
+									FALSE,
 									-1,
 									-1,
 									SYMINFO_SIMPLE|
 									SYMINFO_KIND|
-									SYMINFO_ACCESS,
-									filter_array,
-									FALSE
+									SYMINFO_ACCESS
 									);
 	}
 	

Modified: branches/anjuta-symbol-db/plugins/symbol-db/tables.sql
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/tables.sql	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/tables.sql	Thu Jan 31 18:36:39 2008
@@ -112,13 +112,13 @@
 
 CREATE INDEX sym_type_idx_2 ON sym_type (type, type_name);
 
-CREATE TRIGGER delete_file BEFORE DELETE ON file
+CREATE TRIGGER delete_file_trg BEFORE DELETE ON file
 FOR EACH ROW
-    BEGIN
+BEGIN
     DELETE FROM symbol WHERE file_defined_id = (SELECT file_id FROM file WHERE file_path = old.file_path);
 END;
 
-CREATE TRIGGER delete_symbol BEFORE DELETE ON symbol
+CREATE TRIGGER delete_symbol_trg BEFORE DELETE ON symbol
 FOR EACH ROW
 BEGIN
     DELETE FROM scope WHERE scope.scope_id=old.scope_definition_id;
@@ -126,8 +126,3 @@
     UPDATE symbol SET scope_id='-1' WHERE symbol.scope_id=old.scope_definition_id AND symbol.scope_id > 0;
     INSERT INTO __tmp_removed (symbol_removed_id) VALUES (old.symbol_id);
 END;
-
-PRAGMA page_size = 32768;
-PRAGMA default_cache_size = 12288;
-PRAGMA default_synchronous = OFF; 
-PRAGMA default_temp_store = MEMORY;



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