anjuta r3813 - in trunk: . libanjuta libanjuta/interfaces plugins plugins/class-inheritance plugins/language-support-cpp-java plugins/profiler plugins/symbol-browser plugins/symbol-db plugins/symbol-db/test



Author: jhs
Date: Thu Apr  3 16:02:35 2008
New Revision: 3813
URL: http://svn.gnome.org/viewvc/anjuta?rev=3813&view=rev

Log:
2008-04-03  Johannes Schmid  <jhs gnome org>

	* configure.in:
	* libanjuta/anjuta-launcher.c (anjuta_launcher_scan_output),
	(anjuta_launcher_scan_error), (anjuta_launcher_scan_pty):
	* libanjuta/interfaces/libanjuta.idl:
	* plugins/Makefile.am:
	* 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_iface_init):
	* plugins/symbol-db/Makefile.am:
	* plugins/symbol-db/anjuta-symbol-db.glade:
	* plugins/symbol-db/plugin.c
	(on_editor_buffer_symbols_update_timeout), (on_editor_saved),
	(value_added_current_editor), (goto_local_tree_iter),
	(goto_global_tree_iter), (on_global_treeview_row_expanded),
	(on_global_treeview_row_collapsed), (on_project_element_added),
	(on_project_element_removed), (on_importing_project_end),
	(do_import_sources_after_abort), (do_import_sources),
	(project_root_added), (project_root_removed), (symbol_db_activate),
	(symbol_db_deactivate), (isymbol_manager_search),
	(isymbol_manager_get_members), (isymbol_manager_get_class_parents),
	(isymbol_manager_iface_init), (ipreferences_merge),
	(ipreferences_unmerge), (ipreferences_iface_init):
	* plugins/symbol-db/plugin.h:
	* plugins/symbol-db/symbol-db-engine-iterator-node.c
	(symbol_db_engine_iterator_node_new),
	(sdb_engine_iterator_node_instance_init),
	(sdb_engine_iterator_node_finalize),
	(symbol_db_engine_iterator_node_get_symbol_id),
	(symbol_db_engine_iterator_node_get_symbol_name),
	(symbol_db_engine_iterator_node_get_symbol_file_pos),
	(symbol_db_engine_iterator_node_get_symbol_is_file_scope),
	(symbol_db_engine_iterator_node_get_symbol_signature),
	(symbol_db_engine_iterator_node_get_symbol_extra_string),
	(isymbol_get_name), (isymbol_get_args),
	(isymbol_get_extra_info_string), (isymbol_get_uri),
	(isymbol_get_line), (isymbol_get_icon), (isymbol_get_sym_type),
	(isymbol_iface_init):
	* plugins/symbol-db/symbol-db-engine-iterator.c
	(symbol_db_engine_iterator_new):
	* plugins/symbol-db/symbol-db-engine.c
	(sdb_engine_execute_unknown_sql), (sdb_engine_execute_select_sql),
	(sdb_engine_execute_non_select_sql), (sdb_engine_get_query_by_id),
	(sdb_engine_free_cached_queries), (sdb_engine_disconnect_from_db),
	(sdb_engine_populate_db_by_tags), (sdb_engine_ctags_output_thread),
	(sdb_engine_timeout_trigger_signals), (sdb_engine_thread_monitor),
	(sdb_engine_ctags_output_callback_1), (sdb_engine_scan_files_1),
	(sdb_engine_init), (sdb_engine_finalize),
	(sdb_engine_set_defaults_db_parameters),
	(sdb_engine_connect_to_db), (sdb_engine_create_db_tables),
	(symbol_db_engine_close_db), (symbol_db_engine_open_db),
	(sdb_engine_get_tuple_id_by_unique_name),
	(sdb_engine_get_tuple_id_by_unique_name2),
	(sdb_engine_get_tuple_id_by_unique_name3),
	(symbol_db_engine_add_new_workspace),
	(symbol_db_engine_project_exists),
	(symbol_db_engine_add_new_project), (sdb_engine_add_new_language),
	(sdb_engine_add_new_file), (symbol_db_engine_add_new_files),
	(sdb_engine_add_new_sym_type), (sdb_engine_add_new_sym_kind),
	(sdb_engine_add_new_sym_access),
	(sdb_engine_add_new_sym_implementation),
	(sdb_engine_add_new_heritage),
	(sdb_engine_add_new_scope_definition),
	(sdb_engine_add_new_tmp_heritage_scope),
	(sdb_engine_second_pass_update_scope_1),
	(sdb_engine_second_pass_update_heritage),
	(sdb_engine_second_pass_do), (sdb_engine_add_new_symbol),
	(sdb_engine_detects_removed_ids), (sdb_engine_update_file),
	(on_scan_update_files_symbols_end),
	(symbol_db_engine_fill_type_array),
	(symbol_db_engine_update_files_symbols),
	(symbol_db_engine_update_project_symbols),
	(symbol_db_engine_remove_file), (on_scan_update_buffer_end),
	(symbol_db_engine_update_buffer_symbols),
	(symbol_db_engine_get_files_with_zero_symbols),
	(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_get_full_local_path),
	(symbol_db_engine_get_file_db_path),
	(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-prefs.c
	(on_prefs_executable_changed), (on_gconf_notify_prefs),
	(pkg_list_compare), (on_cflags_output), (on_cflags_exit),
	(on_listall_output), (on_listall_exit), (files_visit_dir),
	(on_tag_load_toggled), (symbol_db_prefs_init),
	(symbol_db_prefs_finalize):
	* plugins/symbol-db/symbol-db-prefs.h:
	* 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_row_expanded_idle), (sdb_view_namespace_row_expanded),
	(sdb_view_global_row_expanded), (sdb_view_vars_row_expanded),
	(sdb_view_build_and_display_base_tree):
	* plugins/symbol-db/symbol-db.glade:
	* plugins/symbol-db/symbol-db.ui:
	* plugins/symbol-db/tables.sql:
	* plugins/symbol-db/test/Makefile.am:
	* plugins/symbol-db/test/main.c (get_parents), (main),
	(packages_foreach), (files_visit_dir):
	
	Merged changes from symbol-db branch

Added:
   trunk/plugins/symbol-db/anjuta-symbol-db.glade
      - copied, changed from r3812, /trunk/plugins/symbol-db/symbol-db.glade
   trunk/plugins/symbol-db/symbol-db-prefs.c
   trunk/plugins/symbol-db/symbol-db-prefs.h
   trunk/plugins/symbol-db/test/benchmark.c
      - copied unchanged from r3812, /branches/anjuta-symbol-db/plugins/symbol-db/test/benchmark.c
Removed:
   trunk/plugins/symbol-db/symbol-db.glade
Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/libanjuta/anjuta-launcher.c
   trunk/libanjuta/interfaces/libanjuta.idl
   trunk/plugins/Makefile.am
   trunk/plugins/class-inheritance/class-inherit.c
   trunk/plugins/language-support-cpp-java/cpp-java-assist.c
   trunk/plugins/profiler/gprof-view.c
   trunk/plugins/symbol-browser/an_symbol.c
   trunk/plugins/symbol-browser/an_symbol.h
   trunk/plugins/symbol-browser/an_symbol_view.c
   trunk/plugins/symbol-browser/plugin.c
   trunk/plugins/symbol-db/Makefile.am
   trunk/plugins/symbol-db/plugin.c
   trunk/plugins/symbol-db/plugin.h
   trunk/plugins/symbol-db/symbol-db-engine-iterator.c
   trunk/plugins/symbol-db/symbol-db-engine.c
   trunk/plugins/symbol-db/symbol-db-engine.h
   trunk/plugins/symbol-db/symbol-db-view-locals.c
   trunk/plugins/symbol-db/symbol-db-view.c
   trunk/plugins/symbol-db/symbol-db.ui
   trunk/plugins/symbol-db/tables.sql
   trunk/plugins/symbol-db/test/Makefile.am
   trunk/plugins/symbol-db/test/main.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Thu Apr  3 16:02:35 2008
@@ -51,7 +51,7 @@
 GTKSOURCEVIEW_GTK_REQUIRED=2.10
 BINUTILS_REQUIRED=2.15.92
 LIBWNCK_REQUIRED=2.12
-GDA_REQUIRED=3.1.3
+GDA_REQUIRED=3.99.1
 
 dnl LIBGTODO_REQUIRED=0.15
 
@@ -482,7 +482,7 @@
 	AC_MSG_RESULT(no)
 	
 	PKG_CHECK_MODULES(PLUGIN_SYMBOL_DB,
-		[libgda-3.0 >= $GDA_REQUIRED],
+		[libgda-4.0 >= $GDA_REQUIRED],
 		[symboldb="yes"],
 		[symboldb="no"])
 	AC_SUBST(PLUGIN_SYMBOL_DB_CFLAGS)
@@ -1145,6 +1145,7 @@
 plugins/symbol-browser/Makefile
 plugins/symbol-browser/images/Makefile
 plugins/symbol-db/Makefile
+plugins/symbol-db/test/Makefile
 plugins/cvs-plugin/Makefile
 plugins/project-wizard/Makefile
 plugins/macro/Makefile

Modified: trunk/libanjuta/anjuta-launcher.c
==============================================================================
--- trunk/libanjuta/anjuta-launcher.c	(original)
+++ trunk/libanjuta/anjuta-launcher.c	Thu Apr  3 16:02:35 2008
@@ -773,7 +773,6 @@
 			/* Ignore illegal characters */
 			if (err && err->domain == G_CONVERT_ERROR)
 			{
-				g_warning ("stdout: %s", err->message);
 				g_error_free (err);
 				err = NULL;
 			}
@@ -781,7 +780,6 @@
 			/* if not related to non blocking read or interrupted syscall */
 			else if (err && errno != EAGAIN && errno != EINTR)
 			{
-				g_warning ("stdout: %s", err->message);
 				launcher->priv->stdout_is_done = TRUE;
 				anjuta_launcher_synchronize (launcher);
 				ret = FALSE;
@@ -829,7 +827,6 @@
 			/* Ignore illegal characters */
 			if (err && err->domain == G_CONVERT_ERROR)
 			{
-				g_warning ("stderr: %s", err->message);
 				g_error_free (err);
 				err = NULL;
 			}
@@ -837,7 +834,6 @@
 			/* if not related to non blocking read or interrupted syscall */
 			else if (err && errno != EAGAIN && errno != EINTR)
 			{
-				g_warning ("stderr: %s", err->message);
 				
 				launcher->priv->stderr_is_done = TRUE;
 				anjuta_launcher_synchronize (launcher);
@@ -892,7 +888,6 @@
 			/* Ignore illegal characters */
 			if (err && err->domain == G_CONVERT_ERROR)
 			{
-				g_warning ("pty: %s", err->message);
 				g_error_free (err);
 				err = NULL;
 			}
@@ -900,7 +895,6 @@
 			/* if not related to non blocking read or interrupted syscall */
 			else if (err && errno != EAGAIN && errno != EINTR)
 			{
-				g_warning ("pty: %s", err->message);
 				ret = FALSE;
 			}
 		/* Read next chars if buffer was too small

Modified: trunk/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- trunk/libanjuta/interfaces/libanjuta.idl	(original)
+++ trunk/libanjuta/interfaces/libanjuta.idl	Thu Apr  3 16:02:35 2008
@@ -4337,68 +4337,100 @@
 	{
 		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 *uri ();   	     // URI 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_uri:
+	 * The uri of the symbol
+	 */
+	const gchar *get_uri();
+	
+	/**
+	* 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
 }
 
 /**
@@ -4418,17 +4450,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:
@@ -4441,7 +4477,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:
@@ -4453,7 +4489,7 @@
 	* 
 	* Returns: fixme
 	*/
-	IAnjutaIterable* get_parents (const gchar *symbol_name);
+	IAnjutaIterable* get_class_parents (IAnjutaSymbol *symbol, IAnjutaSymbolField info_fields);	
 }
 
 /**

Modified: trunk/plugins/Makefile.am
==============================================================================
--- trunk/plugins/Makefile.am	(original)
+++ trunk/plugins/Makefile.am	Thu Apr  3 16:02:35 2008
@@ -13,7 +13,6 @@
 	file-wizard \
 	project-wizard \
 	project-manager \
-	symbol-browser \
 	sample1 \
 	cvs-plugin \
 	macro \
@@ -32,6 +31,7 @@
 	profiler \
 	language-manager \
 	symbol-db \
+	symbol-browser \
 	sourceview
 
 # indent

Modified: trunk/plugins/class-inheritance/class-inherit.c
==============================================================================
--- trunk/plugins/class-inheritance/class-inherit.c	(original)
+++ trunk/plugins/class-inheritance/class-inherit.c	Thu Apr  3 16:02:35 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, *uri;
-					GdkPixbuf *pixbuf;
-					gint line;
-					
-					name = ianjuta_symbol_name (symbol, NULL);
-					pixbuf = ianjuta_symbol_icon (symbol, NULL);
-					uri = ianjuta_symbol_uri (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 (uri)
-					{
-						g_object_set_data_full (G_OBJECT (item), "__uri",
-												g_strdup (uri), 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,10 +453,29 @@
 	
 	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" */
@@ -505,14 +575,14 @@
 					
 			/* go on with the icons */
 			if (symbol_iter && ianjuta_iterable_get_length (symbol_iter, NULL) > 0) {
-				GdkPixbuf *pixbuf;
+				const GdkPixbuf *pixbuf;
 				const gchar* uri;
 				gint line;
 				IAnjutaSymbol *symbol = IANJUTA_SYMBOL (symbol_iter);
 
-				uri = ianjuta_symbol_uri (symbol, NULL);
-				line = ianjuta_symbol_line (symbol, NULL);
-				pixbuf = ianjuta_symbol_icon (symbol, NULL);
+				uri = ianjuta_symbol_get_uri (symbol, 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 +613,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 +885,6 @@
 	IAnjutaSymbol *symbol;
 	GList *classes, *node;
 	GHashTable *class_parents;
-	gboolean first;
 
 	g_return_if_fail (plugin != NULL);
 
@@ -824,15 +896,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 +927,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: trunk/plugins/language-support-cpp-java/cpp-java-assist.c
==============================================================================
--- trunk/plugins/language-support-cpp-java/cpp-java-assist.c	(original)
+++ trunk/plugins/language-support-cpp-java/cpp-java-assist.c	Thu Apr  3 16:02:35 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)
 	{
@@ -479,16 +484,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: trunk/plugins/profiler/gprof-view.c
==============================================================================
--- trunk/plugins/profiler/gprof-view.c	(original)
+++ trunk/plugins/profiler/gprof-view.c	Thu Apr  3 16:02:35 2008
@@ -125,6 +125,8 @@
 	{									   	
 		symbol_iter = ianjuta_symbol_manager_search (self->priv->symbol_manager,
 													 IANJUTA_SYMBOL_TYPE_FUNCTION,
+													 TRUE,
+													 IANJUTA_SYMBOL_FIELD_SIMPLE,
 													 symbol_name,
 													 FALSE,
 													 TRUE,
@@ -134,8 +136,8 @@
 			ianjuta_iterable_get_length (symbol_iter, NULL) > 0)
 		{
 			symbol = IANJUTA_SYMBOL (symbol_iter);
-			uri = ianjuta_symbol_uri (symbol, NULL);
-			line = ianjuta_symbol_line (symbol, NULL);
+			uri = ianjuta_symbol_get_uri (symbol, NULL);
+			line = ianjuta_symbol_get_line (symbol, NULL);
 			
 			ianjuta_document_manager_goto_uri_line (self->priv->document_manager, 
 													 uri, line, NULL);

Modified: trunk/plugins/symbol-browser/an_symbol.c
==============================================================================
--- trunk/plugins/symbol-browser/an_symbol.c	(original)
+++ trunk/plugins/symbol-browser/an_symbol.c	Thu Apr  3 16:02:35 2008
@@ -83,6 +83,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)
 {
@@ -103,38 +112,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;
 
@@ -144,67 +123,85 @@
 	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;	
-}
+	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 const gchar*
 isymbol_uri (IAnjutaSymbol *isymbol, GError **err)
@@ -226,7 +223,7 @@
 }
 
 static gulong
-isymbol_line (IAnjutaSymbol *isymbol, GError **err)
+isymbol_get_line (IAnjutaSymbol *isymbol, GError **err)
 {
 	AnjutaSymbol *s;
 
@@ -248,7 +245,7 @@
 }
 
 static const GdkPixbuf*
-isymbol_icon (IAnjutaSymbol *isymbol, GError **err)
+isymbol_get_icon (IAnjutaSymbol *isymbol, GError **err)
 {
 	AnjutaSymbol *s;
 	SVNodeType node_type;
@@ -263,23 +260,19 @@
 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->uri = isymbol_uri;
-	iface->line = isymbol_line;
+	iface->get_uri = isymbol_uri;
+	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: trunk/plugins/symbol-browser/an_symbol.h
==============================================================================
--- trunk/plugins/symbol-browser/an_symbol.h	(original)
+++ trunk/plugins/symbol-browser/an_symbol.h	Thu Apr  3 16:02:35 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: trunk/plugins/symbol-browser/an_symbol_view.c
==============================================================================
--- trunk/plugins/symbol-browser/an_symbol_view.c	(original)
+++ trunk/plugins/symbol-browser/an_symbol_view.c	Thu Apr  3 16:02:35 2008
@@ -1167,6 +1167,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: trunk/plugins/symbol-browser/plugin.c
==============================================================================
--- trunk/plugins/symbol-browser/plugin.c	(original)
+++ trunk/plugins/symbol-browser/plugin.c	Thu Apr  3 16:02:35 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);
@@ -1200,7 +1210,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;
 }
 
 static void

Modified: trunk/plugins/symbol-db/Makefile.am
==============================================================================
--- trunk/plugins/symbol-db/Makefile.am	(original)
+++ trunk/plugins/symbol-db/Makefile.am	Thu Apr  3 16:02:35 2008
@@ -1,18 +1,13 @@
 if HAVE_PLUGIN_SYMBOL_DB
 
-#SUBDIRS = test
-
-# Plugin UI file
-symbol_db_uidir = $(anjuta_ui_dir)
-symbol_db_ui_DATA =  symbol-db.ui
+SUBDIRS = test
 
 symbol_db_datadir = $(anjuta_data_dir)
 symbol_db_data_DATA = tables.sql
 
-
 # Plugin Glade file
 symbol_db_gladedir = $(anjuta_glade_dir)
-symbol_db_glade_DATA =  symbol-db.glade
+symbol_db_glade_DATA =  anjuta-symbol-db.glade
 
 # Plugin Icon file
 symbol_db_pixmapsdir = $(anjuta_image_dir)
@@ -35,16 +30,11 @@
 
 # Include paths
 AM_CPPFLAGS = \
-	-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
-	-DANJUTA_DATA_DIR=\"$(anjuta_data_dir)\" \
-	-DANJUTA_PLUGIN_DIR=\"$(anjuta_plugin_dir)\" \
-	-DANJUTA_IMAGE_DIR=\"$(anjuta_image_dir)\" \
-	-DANJUTA_GLADE_DIR=\"$(anjuta_glade_dir)\" \
-	-DANJUTA_UI_DIR=\"$(anjuta_ui_dir)\" \
-	-DPACKAGE_SRC_DIR=\"$(srcdir)\" \
+	$(WARN_CFLAGS) \
+	$(DEPRECATED_FLAGS) \
+	$(GDL_CFLAGS) \
 	$(LIBANJUTA_CFLAGS) \
-	$(PLUGIN_SYMBOL_DB_CFLAGS) \
-	$(GDL_CFLAGS)
+	$(PLUGIN_SYMBOL_DB_CFLAGS)
 
 # Where to install the plugin
 plugindir = $(anjuta_plugin_dir)
@@ -52,8 +42,6 @@
 # The plugin
 plugin_LTLIBRARIES = libanjuta-symbol-db.la
 
-libanjuta_symbol_db_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
-
 # Plugin sources
 libanjuta_symbol_db_la_SOURCES = plugin.c plugin.h \
 	readtags.c readtags.h \
@@ -67,30 +55,28 @@
 	symbol-db-view-search.h \
 	symbol-db-view-search.c \
     symbol-db-engine-iterator-node.h \
-	symbol-db-engine-iterator-node.c
+	symbol-db-engine-iterator-node.c \
+	symbol-db-prefs.c \
+	symbol-db-prefs.h
+
+libanjuta_symbol_db_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
 # Plugin dependencies
 libanjuta_symbol_db_la_LIBADD = \
+	$(GDL_LIBS) \
 	$(LIBANJUTA_LIBS) \
 	$(PLUGIN_SYMBOL_DB_LIBS)
 
-endif
+prefs_glade_files = anjuta-symbol-db.glade
+include $(top_srcdir)/scripts/build-schemas.mk
 
 EXTRA_DIST = \
 	$(plugin_in_files) \
 	$(symbol_db_plugin_DATA) \
-	$(symbol_db_ui_DATA) \
 	$(symbol_db_glade_DATA) \
 	$(symbol_db_pixmaps_DATA)
 
-
-
-
-
-
-
-
-
+endif
 
 
 

Copied: trunk/plugins/symbol-db/anjuta-symbol-db.glade (from r3812, /trunk/plugins/symbol-db/symbol-db.glade)
==============================================================================
--- /trunk/plugins/symbol-db/symbol-db.glade	(original)
+++ trunk/plugins/symbol-db/anjuta-symbol-db.glade	Thu Apr  3 16:02:35 2008
@@ -1,66 +1,171 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
-
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
+<!--Generated with glade3 3.2.2 on Tue Feb 19 21:47:46 2008 by pescio darkslack-->
 <glade-interface>
-
-<widget class="GtkWindow" id="window1">
-  <property name="title" translatable="yes">window1</property>
-  <property name="type">GTK_WINDOW_TOPLEVEL</property>
-  <property name="window_position">GTK_WIN_POS_NONE</property>
-  <property name="modal">False</property>
-  <property name="resizable">True</property>
-  <property name="destroy_with_parent">False</property>
-  <property name="decorated">True</property>
-  <property name="skip_taskbar_hint">False</property>
-  <property name="skip_pager_hint">False</property>
-  <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
-  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
-  <property name="focus_on_map">True</property>
-  <property name="urgency_hint">False</property>
-
-  <child>
-    <widget class="GtkHBox" id="top_widget">
-      <property name="visible">True</property>
-      <property name="homogeneous">False</property>
-      <property name="spacing">0</property>
-
-      <child>
-	<widget class="GtkScrolledWindow" id="scrolledwindow1">
-	  <property name="visible">True</property>
-	  <property name="can_focus">True</property>
-	  <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-	  <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
-	  <property name="shadow_type">GTK_SHADOW_IN</property>
-	  <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
-	  <child>
-	    <widget class="GtkTextView" id="textview1">
-	      <property name="visible">True</property>
-	      <property name="can_focus">True</property>
-	      <property name="editable">True</property>
-	      <property name="overwrite">False</property>
-	      <property name="accepts_tab">True</property>
-	      <property name="justification">GTK_JUSTIFY_LEFT</property>
-	      <property name="wrap_mode">GTK_WRAP_NONE</property>
-	      <property name="cursor_visible">True</property>
-	      <property name="pixels_above_lines">0</property>
-	      <property name="pixels_below_lines">0</property>
-	      <property name="pixels_inside_wrap">0</property>
-	      <property name="left_margin">0</property>
-	      <property name="right_margin">0</property>
-	      <property name="indent">0</property>
-	      <property name="text" translatable="yes">Anjuta Plugin User Interface</property>
-	    </widget>
-	  </child>
-	</widget>
-	<packing>
-	  <property name="padding">0</property>
-	  <property name="expand">True</property>
-	  <property name="fill">True</property>
-	</packing>
-      </child>
-    </widget>
-  </child>
-</widget>
-
+  <widget class="GtkWindow" id="symbol_db_pref_window">
+    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+    <child>
+      <widget class="GtkVBox" id="symbol_prefs">
+        <property name="visible">True</property>
+        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+        <child>
+          <widget class="GtkFrame" id="frame1">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="shadow_type">GTK_SHADOW_NONE</property>
+            <child>
+              <widget class="GtkAlignment" id="alignment1">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <widget class="GtkHBox" id="hbox1">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <child>
+                      <widget class="GtkLabel" id="label2">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="label" translatable="yes">Ctags executable:</property>
+                      </widget>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">False</property>
+                        <property name="padding">5</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkFileChooserButton" id="preferences_folder:text:/:0:symboldb.root">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="preview_widget_active">False</property>
+                        <property name="use_preview_label">False</property>
+                        <property name="title" translatable="yes">Choose Ctags executable</property>
+                      </widget>
+                      <packing>
+                        <property name="padding">5</property>
+                        <property name="pack_type">GTK_PACK_END</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">&lt;b&gt;Global&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+              </widget>
+              <packing>
+                <property name="type">label_item</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="expand">False</property>
+            <property name="padding">5</property>
+          </packing>
+        </child>
+        <child>
+          <widget class="GtkFrame" id="frame2">
+            <property name="visible">True</property>
+            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+            <property name="shadow_type">GTK_SHADOW_NONE</property>
+            <child>
+              <widget class="GtkAlignment" id="alignment2">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="left_padding">12</property>
+                <child>
+                  <widget class="GtkHBox" id="hbox2">
+                    <property name="visible">True</property>
+                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                    <child>
+                      <widget class="GtkScrolledWindow" id="scrolledwindow1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                        <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+                        <property name="shadow_type">GTK_SHADOW_IN</property>
+                        <child>
+                          <widget class="GtkTreeView" id="tags_treeview">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
+                          </widget>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkVButtonBox" id="vbuttonbox1">
+                        <property name="visible">True</property>
+                        <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                        <child>
+                          <widget class="GtkButton" id="button1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="label" translatable="yes">button</property>
+                            <property name="response_id">0</property>
+                          </widget>
+                        </child>
+                        <child>
+                          <widget class="GtkButton" id="button2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="label" translatable="yes">button</property>
+                            <property name="response_id">0</property>
+                          </widget>
+                          <packing>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkButton" id="button3">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                            <property name="label" translatable="yes">button</property>
+                            <property name="response_id">0</property>
+                          </widget>
+                          <packing>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </widget>
+                </child>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label3">
+                <property name="visible">True</property>
+                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="label" translatable="yes">&lt;b&gt;Available API tags&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
+              </widget>
+              <packing>
+                <property name="type">label_item</property>
+              </packing>
+            </child>
+          </widget>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>

Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c	(original)
+++ trunk/plugins/symbol-db/plugin.c	Thu Apr  3 16:02:35 2008
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * plugin.c
- * Copyright (C) Massimo Cora' 2007 <maxcvs email it>
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
  * 
  * plugin.c is free software.
  * 
@@ -37,6 +37,7 @@
 #include <libanjuta/interfaces/ianjuta-markable.h>
 #include <libanjuta/interfaces/ianjuta-language.h>
 #include <libanjuta/interfaces/ianjuta-iterable.h>
+#include <libanjuta/interfaces/ianjuta-preferences.h>
 
 #include <libegg/menu/egg-combo-action.h>
 
@@ -46,15 +47,20 @@
 #include "symbol-db-view-search.h"
 #include "symbol-db-engine.h"
 #include "symbol-db-engine-iterator.h"
+#include "symbol-db-prefs.h"
 
-#define UI_FILE ANJUTA_DATA_DIR"/ui/symbol-db.ui"
-
-#define GLADE_FILE ANJUTA_DATA_DIR"/glade/symbol-db.glade"
 #define ICON_FILE "anjuta-symbol-db-plugin-48.png"
 
 #define TIMEOUT_INTERVAL_SYMBOLS_UPDATE		10000
 #define TIMEOUT_SECONDS_AFTER_LAST_TIP		5
 
+#define CTAGS_PREFS_KEY		"ctags.executable"
+#define CTAGS_PATH			"/usr/bin/ctags"
+#define CHOOSER_WIDGET		"preferences_folder:text:/:0:symboldb.root"
+
+#define LOCAL_ANJUTA_GLOBAL_DB_DIRECTORY 	"/.anjuta"
+
+
 static gpointer parent_class;
 static gboolean need_symbols_update = FALSE;
 static gchar prev_char_added = ' ';
@@ -132,7 +138,6 @@
 		GPtrArray *real_files_list;
 		GPtrArray *text_buffers;
 		GPtrArray *buffer_sizes;
-		gchar *project_name;
 								
 		gchar * local_path = gnome_vfs_get_local_path_from_uri (uri);
 
@@ -145,14 +150,11 @@
 		buffer_sizes = g_ptr_array_new ();
 		g_ptr_array_add (buffer_sizes, (gpointer)buffer_size);	
 
-		project_name = symbol_db_engine_get_opened_project_name (sdb_plugin->sdbe);
-
-		symbol_db_engine_update_buffer_symbols (sdb_plugin->sdbe,
-												project_name,
+		symbol_db_engine_update_buffer_symbols (sdb_plugin->sdbe_project,
+												sdb_plugin->project_opened,
 												real_files_list,
 												text_buffers,
 												buffer_sizes);
-		g_free (project_name);
 												
 		g_free (uri);
 	}
@@ -289,7 +291,7 @@
 			old_uri = NULL;
 
 		/* files_array will be freed once updating has taken place */
-		symbol_db_engine_update_files_symbols (sdb_plugin->sdbe, 
+		symbol_db_engine_update_files_symbols (sdb_plugin->sdbe_project, 
 				sdb_plugin->project_root_dir, files_array, TRUE);
 		g_hash_table_insert (sdb_plugin->editor_connected, editor,
 							 g_strdup (saved_uri));
@@ -331,6 +333,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)
 	{
@@ -340,7 +347,7 @@
 	 
 	symbol_db_view_locals_update_list (
 				SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals),
-				 sdb_plugin->sdbe, local_path);
+				 sdb_plugin->sdbe_project, local_path);
 				 
 	if (g_hash_table_lookup (sdb_plugin->editor_connected, editor) == NULL)
 	{
@@ -420,7 +427,7 @@
 
 	line = symbol_db_view_locals_get_line (SYMBOL_DB_VIEW_LOCALS (
 									sdb_plugin->dbv_view_tree_locals), 
-										   sdb_plugin->sdbe,
+										   sdb_plugin->sdbe_project,
 										   iter);
 
 	DEBUG_PRINT ("got line %d", line);
@@ -449,7 +456,7 @@
 	gchar *file;
 
 	if (symbol_db_view_get_file_and_line (
-			SYMBOL_DB_VIEW (sdb_plugin->dbv_view_tree), sdb_plugin->sdbe,
+			SYMBOL_DB_VIEW (sdb_plugin->dbv_view_tree), sdb_plugin->sdbe_project,
 							iter, &line, &file) == FALSE)
 	{
 		g_warning ("goto_global_tree_iter (): error while trying to get file/line");
@@ -537,7 +544,7 @@
 	DEBUG_PRINT ("on_global_treeview_row_expanded ()");
 
 	symbol_db_view_row_expanded (SYMBOL_DB_VIEW (user_data->dbv_view_tree),
-								user_data->sdbe, iter);
+								user_data->sdbe_project, iter);
 }
 
 static void
@@ -549,7 +556,7 @@
 	DEBUG_PRINT ("on_global_treeview_row_collapsed ()");
 	
 	symbol_db_view_row_collapsed (SYMBOL_DB_VIEW (user_data->dbv_view_tree),
-								user_data->sdbe, iter);
+								user_data->sdbe_project, iter);
 	
 }
 
@@ -620,8 +627,8 @@
 					 filename + strlen(sdb_plugin->project_root_dir) );
 		DEBUG_PRINT ("project_root_dir %s", sdb_plugin->project_root_dir );
 		
-		symbol_db_engine_add_new_files (sdb_plugin->sdbe, 
-			sdb_plugin->project_root_dir, files_array, languages_array, TRUE);
+		symbol_db_engine_add_new_files (sdb_plugin->sdbe_project, 
+			sdb_plugin->project_opened, files_array, languages_array, TRUE);
 		
 		g_free (filename);
 		g_ptr_array_free (files_array, TRUE);
@@ -648,7 +655,7 @@
 		DEBUG_PRINT ("gonna removing %s", 
 					 filename + strlen(sv_plugin->project_root_dir));
 		DEBUG_PRINT ("project_root_dir %s", sv_plugin->project_root_dir );
-		symbol_db_engine_remove_file (sv_plugin->sdbe, 
+		symbol_db_engine_remove_file (sv_plugin->sdbe_project, 
 			sv_plugin->project_root_dir, filename);
 		
 		g_free (filename);
@@ -708,14 +715,14 @@
 	/* re-enable signals receiving on local-view */
 	symbol_db_view_locals_recv_signals_from_engine (
 						SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals), 
-								 sdb_plugin->sdbe, TRUE);
+								 sdb_plugin->sdbe_project, TRUE);
 
 	/* and on global view */
 	symbol_db_view_recv_signals_from_engine (SYMBOL_DB_VIEW (sdb_plugin->dbv_view_tree), 
-								 sdb_plugin->sdbe, TRUE);
+								 sdb_plugin->sdbe_project, TRUE);
 	
 	/* re-active global symbols */
-	symbol_db_view_open (SYMBOL_DB_VIEW (sdb_plugin->dbv_view_tree), sdb_plugin->sdbe);
+	symbol_db_view_open (SYMBOL_DB_VIEW (sdb_plugin->dbv_view_tree), sdb_plugin->sdbe_project);
 	
 	/* disconnect this coz it's not important after the process of importing */
 	g_signal_handlers_disconnect_by_func (dbe, on_single_file_scan_end, data);																 
@@ -727,7 +734,227 @@
 	sdb_plugin->files_count = 0;
 }
 
+/* we assume that sources_array has already unique elements */
+static void
+do_import_sources_after_abort (AnjutaPlugin *plugin, const gchar *root_dir, 
+							   const GPtrArray *sources_array)
+{
+	SymbolDBPlugin *sdb_plugin;
+	GPtrArray* languages_array = NULL;
+	GPtrArray *to_scan_array = NULL;
+	IAnjutaLanguage* lang_manager;
+	gint i;
+	
+	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (plugin);	
+		
+	/* if we're importing first shut off the signal receiving.
+	 * We'll re-enable that on scan-end 
+	 */
+	symbol_db_view_locals_recv_signals_from_engine (																
+				SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals), 
+								 sdb_plugin->sdbe_project, FALSE);
+
+	symbol_db_view_recv_signals_from_engine (																
+				SYMBOL_DB_VIEW (sdb_plugin->dbv_view_tree), 
+								 sdb_plugin->sdbe_project, FALSE);
+				
+	g_signal_connect (G_OBJECT (sdb_plugin->sdbe_project), "scan-end",
+		  G_CALLBACK (on_importing_project_end), plugin);				
+
+	lang_manager =	anjuta_shell_get_interface (plugin->shell, IAnjutaLanguage, 
+										NULL);
+
+	/* create array of languages */
+	languages_array = g_ptr_array_new ();
+	to_scan_array = g_ptr_array_new ();
+	
+	if (!lang_manager)
+	{
+		g_critical ("LanguageManager not found");
+		return;
+	}
+
+	for (i=0; i < sources_array->len; i++) 
+	{
+		const gchar *file_mime;
+		const gchar *lang;
+		const gchar *local_filename;
+		IAnjutaLanguageId lang_id;
+		
+		local_filename = g_ptr_array_index (sources_array, i);
+		
+		if (local_filename == NULL)
+			continue;
+		file_mime = gnome_vfs_get_mime_type_for_name (local_filename);
+					
+		lang_id = ianjuta_language_get_from_mime_type (lang_manager, 
+													 file_mime, NULL);
+					
+		if (!lang_id)
+		{
+			continue;
+		}
+				
+		lang = ianjuta_language_get_name (lang_manager, lang_id, NULL);
+
+		/* test its existence */
+		if (g_file_test (local_filename, G_FILE_TEST_EXISTS) == FALSE) 
+		{
+			continue;
+		}
+					
+		sdb_plugin->files_count++;
+		g_ptr_array_add (languages_array, g_strdup (lang));					
+		g_ptr_array_add (to_scan_array, g_strdup (local_filename));
+	}
+			
+	/* connect to receive signals on single file scan complete. We'll
+	 * update a status bar notifying the user about the status
+	 */
+	g_signal_connect (G_OBJECT (sdb_plugin->sdbe_project), "single-file-scan-end",
+		  G_CALLBACK (on_single_file_scan_end), plugin);
+	
+	symbol_db_engine_add_new_files (sdb_plugin->sdbe_project, sdb_plugin->project_opened,
+					sources_array, languages_array, TRUE);
+			
+	g_ptr_array_foreach (languages_array, (GFunc)g_free, NULL);
+	g_ptr_array_free (languages_array, TRUE);
+	
+	g_ptr_array_foreach (to_scan_array, (GFunc)g_free, NULL);
+	g_ptr_array_free (to_scan_array, TRUE);
+}
+
+static void
+do_import_sources (AnjutaPlugin *plugin, IAnjutaProjectManager *pm, 
+				   const gchar *root_dir)
+{
+	SymbolDBPlugin *sdb_plugin;
+	GList* prj_elements_list;
+	GPtrArray* sources_array = NULL;
+	GPtrArray* languages_array = NULL;
+	GHashTable *check_unique_file;
+	IAnjutaLanguage* lang_manager;
+	gint i;
+	
+	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (plugin);	
+		
+	/* if we're importing first shut off the signal receiving.
+	 * We'll re-enable that on scan-end 
+	 */
+	symbol_db_view_locals_recv_signals_from_engine (																
+				SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals), 
+								 sdb_plugin->sdbe_project, FALSE);
+
+	symbol_db_view_recv_signals_from_engine (																
+				SYMBOL_DB_VIEW (sdb_plugin->dbv_view_tree), 
+								 sdb_plugin->sdbe_project, FALSE);
+				
+	g_signal_connect (G_OBJECT (sdb_plugin->sdbe_project), "scan-end",
+		  G_CALLBACK (on_importing_project_end), plugin);				
+				
+	lang_manager =	anjuta_shell_get_interface (plugin->shell, IAnjutaLanguage, 
+										NULL);
+			
+	if (!lang_manager)
+	{
+		g_critical ("LanguageManager not found");
+		return;
+	}
+								  
+	prj_elements_list = ianjuta_project_manager_get_elements (pm,
+					   IANJUTA_PROJECT_MANAGER_SOURCE,
+					   NULL);
+	
+	/* to speed the things up we must avoid the dups */
+	check_unique_file = g_hash_table_new_full (g_str_hash, 
+						g_str_equal, g_free, g_free);
+
+	DEBUG_PRINT ("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
+	DEBUG_PRINT ("Retrieving %d gbf sources of the project...",
+					 g_list_length (prj_elements_list));
+				
+	for (i=0; i < g_list_length (prj_elements_list); i++)
+	{	
+		gchar *local_filename;
+		const gchar *file_mime;
+		const gchar *lang;
+		IAnjutaLanguageId lang_id;
+					
+		local_filename = 
+			gnome_vfs_get_local_path_from_uri (g_list_nth_data (
+											prj_elements_list, i));
+					
+		if (local_filename == NULL)
+			continue;
+					
+		/* check if it's already present in the list. This avoids
+		 * duplicates.
+		 */
+		if (g_hash_table_lookup (check_unique_file, 
+								 local_filename) == NULL)
+		{
+			g_hash_table_insert (check_unique_file, 
+								 g_strdup (local_filename), 
+								 g_strdup (local_filename));
+		}
+		else 
+		{
+			/* you're a dup! we don't want you */
+			g_free (local_filename);
+			continue;
+		}
+					
+		file_mime = gnome_vfs_get_mime_type_for_name (local_filename);
+					
+		lang_id = ianjuta_language_get_from_mime_type (lang_manager, 
+													 file_mime, NULL);
+					
+		if (!lang_id)
+		{
+			g_free (local_filename);
+			continue;
+		}
+				
+		lang = ianjuta_language_get_name (lang_manager, lang_id, NULL);
+		DEBUG_PRINT ("Language of %s is %s", local_filename, file_mime);
+		/* test its existence */
+		if (g_file_test (local_filename, G_FILE_TEST_EXISTS) == FALSE) 
+		{
+			g_free (local_filename);
+			continue;
+		}
+					
+		if (!sources_array)
+			sources_array = g_ptr_array_new ();
+					
+		if (!languages_array)
+			languages_array = g_ptr_array_new ();
 
+		sdb_plugin->files_count++;
+		g_ptr_array_add (sources_array, local_filename);
+		g_ptr_array_add (languages_array, g_strdup (lang));					
+	}
+			
+	DEBUG_PRINT ("calling symbol_db_engine_add_new_files  with root_dir %s",
+			 root_dir);
+
+	/* connect to receive signals on single file scan complete. We'll
+	 * update a status bar notifying the user about the status
+	 */
+	g_signal_connect (G_OBJECT (sdb_plugin->sdbe_project), "single-file-scan-end",
+		  G_CALLBACK (on_single_file_scan_end), plugin);
+	
+	symbol_db_engine_add_new_files (sdb_plugin->sdbe_project, sdb_plugin->project_opened,
+					sources_array, languages_array, TRUE);
+				
+	g_hash_table_unref (check_unique_file);
+				
+	g_ptr_array_foreach (sources_array, (GFunc)g_free, NULL);
+	g_ptr_array_free (sources_array, TRUE);
+
+	g_ptr_array_foreach (languages_array, (GFunc)g_free, NULL);
+	g_ptr_array_free (languages_array, TRUE);	
+}
 
 /* add a new project */
 static void
@@ -744,18 +971,24 @@
 	pm = anjuta_shell_get_interface (ANJUTA_PLUGIN (sdb_plugin)->shell,
 									 IAnjutaProjectManager, NULL);
 	
+		
 	g_free (sdb_plugin->project_root_uri);
 	sdb_plugin->project_root_uri = NULL;
 	root_uri = g_value_get_string (value);
+	
 	if (root_uri)
 	{
 		gchar *root_dir = gnome_vfs_get_local_path_from_uri (root_uri);
-		DEBUG_PRINT ("Symbol-DB: added project %s", root_dir);
+		DEBUG_PRINT ("Symbol-DB: added project root_dir %s, name %s", root_dir, name);
+		
+		/* FIXME: where's the project name itself? */
+		DEBUG_PRINT ("FIXME: where's the project name itself? ");
+		sdb_plugin->project_opened = g_strdup (root_dir);
+		
 		if (root_dir)
 		{
 			gboolean needs_sources_scan = FALSE;
 			gboolean project_exist = FALSE;
-			gint i;
 			GHashTable* lang_hash; 
 				
 			lang_hash = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, 
@@ -767,7 +1000,7 @@
 			/* is it a fresh-new project? is it an imported project with 
 			 * no 'new' symbol-db database but the 'old' one symbol-browser? 
 			 */
-			if (symbol_db_engine_db_exists (sdb_plugin->sdbe, root_dir) == FALSE)
+			if (symbol_db_engine_db_exists (sdb_plugin->sdbe_project, root_dir) == FALSE)
 			{
 				DEBUG_PRINT ("Symbol-DB: project did not exist");
 				needs_sources_scan = TRUE;
@@ -778,168 +1011,55 @@
 				project_exist = TRUE;
 			}
 
-			if (symbol_db_engine_open_db (sdb_plugin->sdbe, root_dir) == FALSE)
+			/* we'll use the same values for db_directory and project_directory */
+			DEBUG_PRINT ("opening db %s and project_dir %s", root_dir, root_dir);
+			if (symbol_db_engine_open_db (sdb_plugin->sdbe_project, root_dir, root_dir) == FALSE)
 				g_error ("Symbol-DB: error in opening db");
 
 			/* if project did not exist add a new project */
 			if (project_exist == FALSE)
 			{
 				DEBUG_PRINT ("Symbol-DB: creating new project.");
-				symbol_db_engine_add_new_project (sdb_plugin->sdbe,
-												  NULL,	/* still no workspace */
-												  root_dir);
-			}			
-
-			/* open the project. we can do this only if the db was loaded */
-			if (symbol_db_engine_open_project (sdb_plugin->sdbe, root_dir) == FALSE)
-			{
-				g_error ("Symbol-DB: error in opening project");
+				symbol_db_engine_add_new_project (sdb_plugin->sdbe_project,
+												  NULL,	/* still no workspace logic */
+												  sdb_plugin->project_opened);
 			}
 
-			/* needs an import */
+			/* we need an import */
 			if (needs_sources_scan == TRUE)
 			{
-				GList* prj_elements_list;
-				GPtrArray* sources_array = NULL;
-				GPtrArray* languages_array = NULL;
-				GHashTable *check_unique_file;
-				IAnjutaLanguage* lang_manager;
-				
-				/* if we're importing first shut off the signal receiving.
-				 * We'll re-enable that on scan-end 
-				 */
-				symbol_db_view_locals_recv_signals_from_engine (																
-							SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals), 
-											 sdb_plugin->sdbe, FALSE);
-
-				symbol_db_view_recv_signals_from_engine (																
-							SYMBOL_DB_VIEW (sdb_plugin->dbv_view_tree), 
-											 sdb_plugin->sdbe, FALSE);
-				
-				g_signal_connect (G_OBJECT (sdb_plugin->sdbe), "scan-end",
-					  G_CALLBACK (on_importing_project_end), plugin);
-				
+				DEBUG_PRINT ("Symbol-DB: importing sources...");
+				do_import_sources (plugin, pm, root_dir);				
+			}
+			else	/* no import needed. */
+			{								
+				/* we may have aborted the scan of sources ..*/
+				GPtrArray *sources_array = NULL;
 				
-				lang_manager =	anjuta_shell_get_interface (plugin->shell, IAnjutaLanguage, 
-													NULL);
-			
-				if (!lang_manager)
+				sources_array = symbol_db_engine_get_files_with_zero_symbols (sdb_plugin->sdbe_project);
+
+				if (sources_array != NULL && sources_array->len > 0) 
 				{
-					g_critical ("LanguageManager not found");
-					return;
-				}
-								  
-				prj_elements_list = ianjuta_project_manager_get_elements (pm,
-								   IANJUTA_PROJECT_MANAGER_SOURCE,
-								   NULL);
-				/* to speed the things up we must avoid the dups */
-				check_unique_file = g_hash_table_new_full (g_str_hash, 
-									g_str_equal, g_free, g_free);
-
-				DEBUG_PRINT ("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
-				DEBUG_PRINT ("Retrieving %d gbf sources of the project...",
-							 g_list_length (prj_elements_list));
-				
-				for (i=0; i < g_list_length (prj_elements_list); i++)
-				{	
-					gchar *local_filename;
-					const gchar *file_mime;
-					const gchar *lang;
-					IAnjutaLanguageId lang_id;
-					
-					local_filename = 
-						gnome_vfs_get_local_path_from_uri (g_list_nth_data (
-														prj_elements_list, i));
-					
-					if (local_filename == NULL)
-						continue;
+					DEBUG_PRINT ("do_import_sources_after_abort ");
+					do_import_sources_after_abort (plugin, root_dir, sources_array);
 					
-					/* check if it's already present in the list. This to avoid
-					 * duplicates.
-					 */
-					if (g_hash_table_lookup (check_unique_file, 
-											 local_filename) == NULL)
-					{
-						g_hash_table_insert (check_unique_file, 
-											 g_strdup (local_filename), 
-											 g_strdup (local_filename));
-					}
-					else 
-					{
-						DEBUG_PRINT ("%s go away!", local_filename);
-						/* you're a dup! we don't want you */
-						g_free (local_filename);
-						continue;
-					}
-					
-					file_mime = gnome_vfs_get_mime_type_for_name (local_filename);
-					
-					lang_id = ianjuta_language_get_from_mime_type (lang_manager, 
-																 file_mime, NULL);
-					
-					if (!lang_id)
-					{
-						g_free (local_filename);
-						continue;
-					}
-				
-					lang = ianjuta_language_get_name (lang_manager, lang_id, NULL);
-					DEBUG_PRINT ("Language of %s is %s", local_filename, file_mime);
-					/* test its existence */
-					if (g_file_test (local_filename, G_FILE_TEST_EXISTS) == FALSE) 
-					{
-						g_free (local_filename);
-						continue;
-					}
-					
-					if (!sources_array)
-					{
-						sources_array = g_ptr_array_new ();
-					}	
-					
-					if (!languages_array)
-					{
-						languages_array = g_ptr_array_new ();
-					}
-
-					sdb_plugin->files_count++;
-					g_ptr_array_add (sources_array, local_filename);
-					g_ptr_array_add (languages_array, g_strdup (lang));					
+					g_ptr_array_foreach (sources_array, (GFunc)g_free, NULL);
+					g_ptr_array_free (sources_array, TRUE);
 				}
-			
-				DEBUG_PRINT ("calling symbol_db_engine_add_new_files  with root_dir %s",
-							 root_dir);
-
-				/* connect to receive signals on single file scan complete. We'll
-				 * update a status bar notifying the user about the status
-				 */
-				g_signal_connect (G_OBJECT (sdb_plugin->sdbe), "single-file-scan-end",
-					  G_CALLBACK (on_single_file_scan_end), plugin);
-				
-				symbol_db_engine_add_new_files (sdb_plugin->sdbe, root_dir,
-									sources_array, languages_array, TRUE);
-				
-				g_hash_table_unref (lang_hash);
-				g_hash_table_unref (check_unique_file);
-				
-				g_ptr_array_foreach (sources_array, (GFunc)g_free, NULL);
-				g_ptr_array_free (sources_array, TRUE);
 
-				g_ptr_array_foreach (languages_array, (GFunc)g_free, NULL);
-				g_ptr_array_free (languages_array, TRUE);
-			}
-			else	/* no import needed. Update the symbols */
-			{
-				symbol_db_engine_update_project_symbols (sdb_plugin->sdbe, root_dir);
+				/* Update the symbols */
+				symbol_db_engine_update_project_symbols (sdb_plugin->sdbe_project, root_dir);
 			}
 			anjuta_status_progress_tick (status, NULL, _("Populating symbols' db..."));
 			anjuta_status_progress_add_ticks (status, sdb_plugin->files_count);
 			
 			symbol_db_view_open (SYMBOL_DB_VIEW (sdb_plugin->dbv_view_tree),
-								 sdb_plugin->sdbe);
+								 sdb_plugin->sdbe_project);
 
 			/* root dir */
 			sdb_plugin->project_root_dir = root_dir;
+			
+			g_hash_table_unref (lang_hash);			
 		}
 		/* this is uri */
 		sdb_plugin->project_root_uri = g_strdup (root_uri);
@@ -982,29 +1102,48 @@
 	symbol_db_view_clear_cache (SYMBOL_DB_VIEW (sdb_plugin->dbv_view_tree));
 	
 	/* don't forget to close the project */
-	symbol_db_engine_close_project (sdb_plugin->sdbe, 
-									sdb_plugin->project_root_dir);
+	symbol_db_engine_close_db (sdb_plugin->sdbe_project);
 
 	g_free (sdb_plugin->project_root_uri);
 	g_free (sdb_plugin->project_root_dir);
+	g_free (sdb_plugin->project_opened);
 	sdb_plugin->project_root_uri = NULL;
-	sdb_plugin->project_root_dir = NULL;
+	sdb_plugin->project_root_dir = NULL;	
+	sdb_plugin->project_opened = NULL;
 }
 
 static gboolean
 symbol_db_activate (AnjutaPlugin *plugin)
 {
 	SymbolDBPlugin *symbol_db;
+	gchar *home_anjuta_dir;
 	
 	DEBUG_PRINT ("SymbolDBPlugin: Activating SymbolDBPlugin plugin ...");
+	
+	/* Initialize gda library. */
+	gda_init ("AnjutaGda", NULL, 0, NULL);
 
 	register_stock_icons (plugin);
 
 	symbol_db = ANJUTA_PLUGIN_SYMBOL_DB (plugin);
 	symbol_db->ui = anjuta_shell_get_ui (plugin->shell, NULL);
-
-	/* create SymbolDBEngine */
-	symbol_db->sdbe = symbol_db_engine_new ();
+	symbol_db->prefs = anjuta_shell_get_preferences (plugin->shell, NULL);
+	symbol_db->prefs_list_store = NULL;
+	symbol_db->pkg_config_launcher = NULL;
+	symbol_db->project_opened = NULL;
+	
+	/* create SymbolDBEngine(s) */
+	symbol_db->sdbe_project = symbol_db_engine_new ();
+	
+	/* the globals one too */
+	symbol_db->sdbe_globals = symbol_db_engine_new ();
+	/* open it */
+	home_anjuta_dir = g_strdup_printf ("%s%s", g_get_home_dir(),
+									   LOCAL_ANJUTA_GLOBAL_DB_DIRECTORY);
+	symbol_db_engine_open_db (symbol_db->sdbe_globals, 
+							  home_anjuta_dir, "/");
+	g_free (home_anjuta_dir);
+	
 	
 	/* Create widgets */
 	symbol_db->dbv_notebook = gtk_notebook_new();
@@ -1022,7 +1161,7 @@
 	/* activate signals receiving by default */
 	symbol_db_view_locals_recv_signals_from_engine (
 					SYMBOL_DB_VIEW_LOCALS (symbol_db->dbv_view_tree_locals), 
-											 symbol_db->sdbe, TRUE);										 
+											 symbol_db->sdbe_project, TRUE);										 
 
 	g_object_add_weak_pointer (G_OBJECT (symbol_db->dbv_view_tree_locals),
 							   (gpointer)&symbol_db->dbv_view_tree_locals);
@@ -1049,7 +1188,7 @@
 	/* activate signals receiving by default */
 	symbol_db_view_recv_signals_from_engine (
 					SYMBOL_DB_VIEW (symbol_db->dbv_view_tree), 
-											 symbol_db->sdbe, TRUE);										 
+											 symbol_db->sdbe_project, TRUE);										 
 
 	g_signal_connect (G_OBJECT (symbol_db->dbv_view_tree), "row-activated",
 					  G_CALLBACK (on_global_treeview_row_activated), plugin);
@@ -1065,7 +1204,7 @@
 	
 	/* Search symbols */
 	symbol_db->dbv_view_tree_search =
-		(GtkWidget*) symbol_db_view_search_new (symbol_db->sdbe);
+		(GtkWidget*) symbol_db_view_search_new (symbol_db->sdbe_project);
 	symbol_db->dbv_view_search_tab_label = gtk_label_new (_("Search" ));
 
 	g_signal_connect (G_OBJECT (symbol_db->dbv_view_tree_search), "symbol-selected",
@@ -1121,10 +1260,15 @@
 	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;
+	g_object_unref (sdb_plugin->sdbe_project);
+	sdb_plugin->sdbe_project = NULL;
+	
+	g_object_unref (sdb_plugin->sdbe_globals);
+	sdb_plugin->sdbe_globals = NULL;
+	
+	g_free (sdb_plugin->project_opened);
+	sdb_plugin->project_opened = NULL;
 
 	/* disconnect some signals */
 	g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->dbv_view_tree_locals),
@@ -1144,6 +1288,18 @@
 		sdb_plugin->editor_connected = NULL;
 	}
 	
+	if (sdb_plugin->pkg_config_launcher) 
+	{
+		g_object_unref (sdb_plugin->pkg_config_launcher);
+		sdb_plugin->pkg_config_launcher = NULL;
+	}
+		
+	if (sdb_plugin->prefs_list_store)
+	{
+		g_object_unref (sdb_plugin->prefs_list_store);
+		sdb_plugin->prefs_list_store = NULL;
+	}
+	
 	/* Remove watches */
 	anjuta_plugin_remove_watch (plugin, sdb_plugin->root_watch_id, FALSE);
 	anjuta_plugin_remove_watch (plugin, sdb_plugin->editor_watch_id, TRUE);
@@ -1205,6 +1361,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 +1371,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);
+	dbe = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_project);
 	
-	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_project);
+	
+	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_project);
+	
+	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,11 +1461,35 @@
 {
 	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
+ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError** e)
+{
+	DEBUG_PRINT ("SymbolDB: ipreferences_merge");	
+	symbol_db_prefs_init (ANJUTA_PLUGIN_SYMBOL_DB (ipref), prefs);
+}
+
+static void
+ipreferences_unmerge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError** e)
+{
+	symbol_db_prefs_finalize (ANJUTA_PLUGIN_SYMBOL_DB (ipref), prefs);
+}
+
+static void
+ipreferences_iface_init(IAnjutaPreferencesIface* iface)
+{
+	DEBUG_PRINT ("SymbolDB: ipreferences_iface_init");	
+	iface->merge = ipreferences_merge;
+	iface->unmerge = ipreferences_unmerge;	
+}
+
+
 ANJUTA_PLUGIN_BEGIN (SymbolDBPlugin, symbol_db);
 ANJUTA_PLUGIN_ADD_INTERFACE (isymbol_manager, IANJUTA_TYPE_SYMBOL_MANAGER);
+ANJUTA_PLUGIN_ADD_INTERFACE(ipreferences, IANJUTA_TYPE_PREFERENCES);
 ANJUTA_PLUGIN_END;
 
 ANJUTA_SIMPLE_PLUGIN (SymbolDBPlugin, symbol_db);

Modified: trunk/plugins/symbol-db/plugin.h
==============================================================================
--- trunk/plugins/symbol-db/plugin.h	(original)
+++ trunk/plugins/symbol-db/plugin.h	Thu Apr  3 16:02:35 2008
@@ -26,6 +26,7 @@
 #define _SYMBOL_DB_H_
 
 #include <libanjuta/anjuta-plugin.h>
+#include <libanjuta/anjuta-launcher.h>
 #include "symbol-db-engine.h"
 #include "symbol-db-engine-iterator.h"
 
@@ -47,6 +48,11 @@
 	AnjutaPlugin parent;
 	AnjutaUI *ui;
 	AnjutaPreferences *prefs;
+	GtkListStore *prefs_list_store;
+	AnjutaLauncher *pkg_config_launcher;
+//	AnjutaLauncher *cflags_launcher;
+	
+	gint prefs_notify_id;
 	
 	/* project monitor */
 	guint root_watch_id;
@@ -55,9 +61,13 @@
 	guint editor_watch_id;
 	gchar *project_root_uri;
 	gchar *project_root_dir;
+	gchar *project_opened;
+	
+	/* Symbol's engine connection to database. Instance for local project */
+	SymbolDBEngine *sdbe_project;
 	
-	/* Symbol's engine connection to database. */
-	SymbolDBEngine *sdbe;
+	/* global's one */
+	SymbolDBEngine *sdbe_globals;
 	
 	GtkWidget *dbv_notebook;          	/* symbol main window [gtk_notebook] */	
 	GtkWidget *scrolled_global; 		/* symbol view scrolledwindow for global

Modified: trunk/plugins/symbol-db/symbol-db-engine-iterator.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-iterator.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-iterator.c	Thu Apr  3 16:02:35 2008
@@ -92,7 +92,7 @@
 	priv = dbi->priv;
 	
 	priv->data_model = model;
-	priv->data_iter = gda_data_model_iter_new (model);
+	priv->data_iter = gda_data_model_create_iter (model);
 	
 	/* because gda_data_model_get_n_rows () could be cpu-intensive, we'll 
 	 * proxy this value, e.g. it's calculated if it is really needed */

Modified: trunk/plugins/symbol-db/symbol-db-engine.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine.c	Thu Apr  3 16:02:35 2008
@@ -114,6 +114,7 @@
 #include <libanjuta/anjuta-debug.h>
 #include <libanjuta/anjuta-launcher.h>
 #include <libgda/libgda.h>
+#include <sql-parser/gda-sql-parser.h>
 #include "readtags.h"
 #include "symbol-db-engine.h"
 #include "symbol-db-engine-iterator.h"
@@ -122,7 +123,7 @@
 /* file should be specified without the ".db" extension. */
 #define ANJUTA_DB_FILE	".anjuta_sym_db"
 
-#define TABLES_SQL	ANJUTA_DATA_DIR"/tables.sql"
+#define TABLES_SQL	PACKAGE_DATA_DIR"/tables.sql"
 
 #define CTAGS_MARKER	"#_#\n"
 
@@ -131,7 +132,7 @@
 // FIXME: detect it by prefs
 #define CTAGS_PATH		"/usr/bin/ctags"
 
-#define THREADS_MONITOR_LAUNCH_DELAY	200
+#define THREADS_MONITOR_TIMEOUT			50
 #define THREADS_MAX_CONCURRENT			15
 #define TRIGGER_SIGNALS_DELAY			500
 #define	TRIGGER_MAX_CLOSURE_RETRIES		30
@@ -158,6 +159,7 @@
 	PREP_QUERY_GET_ALL_FROM_FILE_BY_PROJECT_NAME,
 	PREP_QUERY_GET_ALL_FROM_FILE_BY_PROJECT_ID,
 	PREP_QUERY_UPDATE_FILE_ANALYSE_TIME,
+	PREP_QUERY_GET_ALL_FROM_FILE_WHERE_NOT_IN_SYMBOLS,
 	PREP_QUERY_LANGUAGE_NEW,
 	PREP_QUERY_GET_LANGUAGE_ID_BY_UNIQUE_NAME,
 	PREP_QUERY_SYM_TYPE_NEW,
@@ -182,6 +184,8 @@
 	PREP_QUERY_UPDATE_SYMBOL_SCOPE_ID,
 	PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY,
 	PREP_QUERY_UPDATE_SYMBOL_ALL,
+	PREP_QUERY_REMOVE_NON_UPDATED_SYMBOLS,
+	PREP_QUERY_RESET_UPDATE_FLAG_SYMBOLS,
 	PREP_QUERY_GET_REMOVED_IDS,
 	PREP_QUERY_TMP_REMOVED_DELETE_ALL,
 	PREP_QUERY_COUNT
@@ -192,7 +196,7 @@
 {
 	query_type query_id;
 	gchar *query_str;
-	GdaQuery *query;
+	GdaStatement *stmt;
 
 } query_node;
 
@@ -272,7 +276,13 @@
 	 PREP_QUERY_UPDATE_FILE_ANALYSE_TIME,
 	 "UPDATE file SET analyse_time = datetime('now', 'localtime') WHERE "
 	 "file_path = ## /* name:'filepath' type:gchararray */",
-	 NULL},
+	 NULL
+	},
+	{
+	 PREP_QUERY_GET_ALL_FROM_FILE_WHERE_NOT_IN_SYMBOLS,
+	 "SELECT * FROM file WHERE file_id NOT IN (SELECT file_defined_id FROM symbol)",
+	 NULL
+	},
 	/* -- language -- */
 	{
 	 PREP_QUERY_LANGUAGE_NEW,
@@ -454,6 +464,20 @@
 	 "gint */",
 	 NULL
 	},
+	{
+	 PREP_QUERY_REMOVE_NON_UPDATED_SYMBOLS,
+	 "DELETE FROM symbol WHERE file_defined_id = (SELECT file_id FROM file "
+	 "WHERE file_path = ## /* name:'filepath' type:gchararray */) "
+	 "AND update_flag = 0",
+	 NULL
+	},
+	{
+	 PREP_QUERY_RESET_UPDATE_FLAG_SYMBOLS,
+	 "UPDATE symbol SET update_flag = 0 "
+	 "WHERE file_defined_id = (SELECT file_id FROM file WHERE "
+	 "file_path = ## /* name:'filepath' type:gchararray */)",
+	 NULL
+	},
 	/* -- tmp_removed -- */
 	{
 	 PREP_QUERY_GET_REMOVED_IDS,
@@ -486,10 +510,9 @@
 struct _SymbolDBEnginePriv
 {
 	GdaConnection *db_connection;
-	GdaClient *gda_client;
-	gchar *dsn_name;
-	gchar *project_name;
-	gchar *data_source;
+	GdaSqlParser *sql_parser;
+	gchar *db_directory;
+	gchar *project_directory;
 
 	GAsyncQueue *scan_queue;	
 	GAsyncQueue *updated_symbols_id;
@@ -525,9 +548,8 @@
 	
 } ThreadDataOutput;
 
-typedef struct _UpdateFileSymbolsData {
-
-	
+typedef struct _UpdateFileSymbolsData {	
+	gchar *project;
 	gboolean update_prj_analyse_time;
 	GPtrArray * files_path;
 	
@@ -544,96 +566,103 @@
 						   gboolean sym_update);
 
 
-/**
- * Malerba here http://bugzilla.gnome.org/show_bug.cgi?id=488860 says that
- * GdaQueries can be seen by a provider as prepared queries. I'm not 100% sure
- * about this but anyway give it a try.
- */
-static void inline
-sdb_engine_execute_non_select_sql (SymbolDBEngine * dbe, const gchar * buffer)
+static gboolean 
+sdb_engine_execute_unknown_sql (SymbolDBEngine *dbe, const gchar *sql)
 {
+	GdaStatement *stmt;
+	GObject *res;
 	SymbolDBEnginePriv *priv;
-	GdaQuery *query;
-	GdaObject *obj;
-
-	priv = dbe->priv;
-
-	query = gda_query_new_from_sql (NULL, buffer, NULL);
-	obj = gda_query_execute (query, NULL, FALSE, NULL);
+	
+	priv = dbe->priv;	
+	
+	stmt = gda_sql_parser_parse_string (priv->sql_parser, sql, NULL, NULL);	
 
-	if (obj != NULL)
-	{
-		g_object_unref (obj);
-	}	
+	if (stmt == NULL)
+		return FALSE;
 	
-	if (query != NULL)
+    if ((res = gda_connection_statement_execute (priv->db_connection, 
+												   (GdaStatement*)stmt, 
+												 	NULL,
+													GDA_STATEMENT_MODEL_RANDOM_ACCESS, 
+													NULL, NULL)) == NULL)
 	{
-		g_object_unref (query);
-	}		
+		g_object_unref (stmt);
+		return FALSE;
+	}
+	else 
+	{
+		g_object_unref (res);
+		g_object_unref (stmt);
+		return TRUE;		
+	}
 }
 
-/**
- * User must care to g_object_unref () the returned data_model.
- */
 static GdaDataModel *
-sdb_engine_execute_select_sql (SymbolDBEngine * dbe, const gchar * buffer)
+sdb_engine_execute_select_sql (SymbolDBEngine * dbe, const gchar *sql)
 {
+	GdaStatement *stmt;
+	GdaDataModel *res;
 	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);
+	const gchar *remain;
+	
+	priv = dbe->priv;	
+	
+	stmt = gda_sql_parser_parse_string (priv->sql_parser, sql, &remain, NULL);	
 
+	if (stmt == NULL)
+		return NULL;
 	
-	if (query != NULL)
-	{
-		g_object_unref (query);
-	}
+    res = gda_connection_statement_execute_select (priv->db_connection, 
+												   (GdaStatement*)stmt, NULL, NULL);
+	if (!res) 
+		DEBUG_PRINT ("Could not execute query: %s\n", sql);
 	
-	if (GDA_DATA_MODEL (obj) == FALSE)
+	if (remain != NULL)
 	{
-		DEBUG_PRINT ("sdb_engine_execute_select_sql (): returning NULL");
-		if (obj)
-			g_object_unref (obj);
-		return NULL;
-	}
+		/* this shouldn't never happen */		
+		sdb_engine_execute_select_sql (dbe, remain);
+	}	
 	
-	return GDA_DATA_MODEL (obj);
+    g_object_unref (stmt);
+	
+	return res;
 }
 
-
-/**
- * Will 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)
+static gint
+sdb_engine_execute_non_select_sql (SymbolDBEngine * dbe, const gchar *sql)
 {
+	GdaStatement *stmt;
+    gint nrows;
 	SymbolDBEnginePriv *priv;
-
-	g_return_val_if_fail (dbe != NULL, FALSE);
+	const gchar *remain;	
+	
 	priv = dbe->priv;
+	stmt = gda_sql_parser_parse_string (priv->sql_parser, 
+										sql, &remain, NULL);
+
+	if (stmt == NULL)
+		return -1;
 	
-	if (priv->project_name == NULL)
-		return FALSE;
+	nrows = gda_connection_statement_execute_non_select (priv->db_connection, stmt, 
+														 NULL, NULL, NULL);
+	if (nrows == -1) 
+    	DEBUG_PRINT ("NON SELECT error: %s\n", sql);
+
+	if (remain != NULL) {
+		/* may happen for example when sql is a file-content */
+		sdb_engine_execute_non_select_sql (dbe, remain);
+	}
 	
-	return strcmp (project_name, priv->project_name) == 0 ? TRUE : FALSE;
+	g_object_unref (stmt);
+	return nrows;
 }
 
-
 /**
  * Use a proxy to return an already present or a fresh new prepared query 
  * from static 'query_list'. We should perform actions in the fastest way, because
  * these queries are time-critical.
  */
-static inline const GdaQuery *
+static inline const GdaStatement *
 sdb_engine_get_query_by_id (SymbolDBEngine * dbe, query_type query_id)
 {
 	query_node *node;
@@ -647,17 +676,19 @@
 	
 	node = &query_list[query_id];
 
-	if (node->query == NULL)
+	if (node->stmt == NULL)
 	{
-		DEBUG_PRINT ("generating new query.... %d", query_id);
-		/* create a new GdaQuery */
-		node->query =
-			gda_query_new_from_sql (NULL, node->query_str, NULL);
+		DEBUG_PRINT ("generating new statement.... %d", query_id);
+		/* create a new GdaStatement */
+		node->stmt =
+			gda_sql_parser_parse_string (priv->sql_parser, node->query_str, NULL, 
+										 NULL);
 	}
 
-	return node->query;
+	return node->stmt;
 }
 
+/* DEPRECATED, REMOVED.
 static inline gint
 sdb_engine_get_last_insert_id (SymbolDBEngine * dbe)
 {
@@ -671,7 +702,7 @@
 	g_free (res);
 	return table_id;
 }
-
+*/
 /**
  * Clear the static cached queries data. You should call this function when closing/
  * destroying SymbolDBEngine object.
@@ -689,10 +720,10 @@
 	{
 		node = &query_list[i];
 
-		if (node->query != NULL)
+		if (node->stmt != NULL)
 		{
-			g_object_unref ((gpointer) node->query);
-			node->query = NULL;
+			g_object_unref ((gpointer) node->stmt);
+			node->stmt = NULL;
 		}
 	}
 }
@@ -705,42 +736,39 @@
 	g_return_val_if_fail (dbe != NULL, FALSE);
 	priv = dbe->priv;
 
-	if (priv->gda_client)
-	{
-		gda_client_close_all_connections (priv->gda_client);
-		g_object_unref (priv->gda_client);
-	}
-	priv->gda_client = NULL;	
+	gda_connection_close (priv->db_connection);
 	priv->db_connection = NULL;
 
-	g_free (priv->data_source);
-	priv->data_source = NULL;
-
-	g_free (priv->dsn_name);
-	priv->dsn_name = NULL;
-
+	if (priv->sql_parser != NULL)
+		g_object_unref (priv->sql_parser);
+	
+	g_free (priv->db_directory);
+	priv->db_directory = NULL;
+	
+	g_free (priv->project_directory);
+	priv->project_directory = NULL;
+	
 	return TRUE;
 }
 
 static GTimer *sym_timer_DEBUG  = NULL;
-static gint files_scanned_DEBUG = 0;
+/*static gint files_scanned_DEBUG = 0; */
 
 /**
- * If base_prj_path != NULL then fake_file will not be parsed. Else
- * if fake_file is != NULL we claim and assert that tags contents which are
+ * If fake_file is != NULL we claim and assert that tags contents which are
  * scanned belong to the fake_file in the project.
  * More: the fake_file refers to just one single file and cannot be used
  * for multiple fake_files.
  */
 static void
 sdb_engine_populate_db_by_tags (SymbolDBEngine * dbe, FILE* fd,
-								gchar * base_prj_path, gchar * fake_file_on_db,
+								gchar * fake_file_on_db,
 								gboolean force_sym_update)
 {
 	tagFile *tag_file;
 	tagFileInfo tag_file_info;
 	tagEntry tag_entry;
-	GdaCommand *command;
+/*	GdaCommand *command;*/
 	
 	SymbolDBEnginePriv *priv;
 
@@ -776,7 +804,7 @@
 	while (tagsNext (tag_file, &tag_entry) != TagFailure)
 	{
 		sdb_engine_add_new_symbol (dbe, &tag_entry, fake_file_on_db == NULL ?
-								   base_prj_path : NULL, fake_file_on_db,
+								   priv->project_directory : NULL, fake_file_on_db,
 								   force_sym_update);
 		
 		tags_total_DEBUG ++;
@@ -786,7 +814,7 @@
 	DEBUG_PRINT ("elapsed: %f for (%d) [%f per symbol]", elapsed_DEBUG,
 				 tags_total_DEBUG, elapsed_DEBUG / tags_total_DEBUG);
 
-
+/*
 	if (files_scanned_DEBUG++ > 50)
 	{
 		DEBUG_PRINT ("analyzing...");
@@ -798,7 +826,7 @@
 
 		files_scanned_DEBUG = 0;
 	}
-	
+*/	
 	DEBUG_PRINT ("EMITTING single-file-scan-end");
 	/* notify listeners that another file has been scanned */
 	g_async_queue_push (priv->signals_queue, (gpointer)(SINGLE_FILE_SCAN_END +1));
@@ -869,15 +897,13 @@
 				if (scan_flag == DO_UPDATE_SYMS ||
 					scan_flag == DO_UPDATE_SYMS_AND_EXIT)
 				{
-					sdb_engine_populate_db_by_tags (dbe, priv->shared_mem_file, 
-								priv->data_source, 
+					sdb_engine_populate_db_by_tags (dbe, priv->shared_mem_file,
 								(int)real_file == DONT_FAKE_UPDATE_SYMS ? NULL : real_file, 
 								TRUE);
 				}
 				else 
 				{
-					sdb_engine_populate_db_by_tags (dbe, priv->shared_mem_file, 
-								priv->data_source, 
+					sdb_engine_populate_db_by_tags (dbe, priv->shared_mem_file,
 								(int)real_file == DONT_FAKE_UPDATE_SYMS ? NULL : real_file, 
 								FALSE);					
 				}
@@ -894,7 +920,7 @@
 				{
 					gint tmp_inserted;
 					gint tmp_updated;
-					
+
 					/* proceed with second passes */
 					DEBUG_PRINT ("FOUND end-of-group-files marker.\n"
 								 "go on with sdb_engine_second_pass_do ()");
@@ -912,7 +938,6 @@
 					while ((tmp_inserted = (int)
 							g_async_queue_try_pop (priv->inserted_symbols_id)) > 0)
 					{
-						DEBUG_PRINT ("EMITTING symbol-inserted %d", tmp_inserted);
 						/* we must be sure to insert both signals at once */
 						g_async_queue_lock (priv->signals_queue);
 						
@@ -927,7 +952,6 @@
 					while ((tmp_updated = (int)
 							g_async_queue_try_pop (priv->updated_symbols_id)) > 0)
 					{
-/*						DEBUG_PRINT ("EMITTING symbol-updated");*/
 						g_async_queue_lock (priv->signals_queue);
 						g_async_queue_push_unlocked (priv->signals_queue, (gpointer)
 													 (SYMBOL_UPDATED + 1));
@@ -942,8 +966,6 @@
 					 */
 					DEBUG_PRINT ("EMITTING scan-end");
 					g_async_queue_push (priv->signals_queue, (gpointer)(SCAN_END + 1));
-					DEBUG_PRINT ("queue length = %d",  
-								 g_async_queue_length (priv->signals_queue));
 				}
 				
 				/* truncate the file to 0 length */
@@ -959,10 +981,10 @@
 				fflush (priv->shared_mem_file);
 				break;
 			}
-			 
+
 			/* found out a new marker */ 
 			marker_ptr = strstr (marker_ptr + len_marker, CTAGS_MARKER);
-		} while (remaining_chars + len_marker < len_chars);
+		} while (remaining_chars + len_marker < len_chars || marker_ptr != NULL);
 	}
 	else 
 	{
@@ -991,7 +1013,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 +1094,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. */
@@ -1085,7 +1107,7 @@
 	{
 		priv->concurrent_threads ++;
 		g_thread_create ((GThreadFunc)sdb_engine_ctags_output_thread, output, 
-					 FALSE, NULL);		
+					 FALSE, NULL);
 		priv->thread_closure_retries = 0;
 	}
 	else 
@@ -1136,8 +1158,11 @@
 	if (priv->thread_monitor_handler <= 0)
 	{
 		priv->thread_monitor_handler = 
-			g_timeout_add (THREADS_MONITOR_LAUNCH_DELAY, 
-						   sdb_engine_thread_monitor, user_data);
+			g_timeout_add_full (G_PRIORITY_LOW,
+					THREADS_MONITOR_TIMEOUT, 
+					sdb_engine_thread_monitor, 
+					user_data,
+					NULL);
 		priv->thread_closure_retries = 0;
 	}
 	
@@ -1145,8 +1170,8 @@
 	if (priv->timeout_trigger_handler <= 0)
 	{
 		priv->timeout_trigger_handler = 
-			g_timeout_add (TRIGGER_SIGNALS_DELAY, 
-						   sdb_engine_timeout_trigger_signals, user_data);
+			g_timeout_add_full (G_PRIORITY_LOW, TRIGGER_SIGNALS_DELAY, 
+						   sdb_engine_timeout_trigger_signals, user_data, NULL);
 		priv->trigger_closure_retries = 0;
 	}
 }
@@ -1205,6 +1230,9 @@
 		DEBUG_PRINT ("creating anjuta_launcher");
 		priv->ctags_launcher = anjuta_launcher_new ();
 
+		anjuta_launcher_set_check_passwd_prompt (priv->ctags_launcher, FALSE);
+		anjuta_launcher_set_encoding (priv->ctags_launcher, NULL);
+		
 		g_signal_connect (G_OBJECT (priv->ctags_launcher), "child-exited",
 						  G_CALLBACK (on_scan_files_end_1), NULL);
 
@@ -1261,8 +1289,8 @@
 			g_warning ("File %s not scanned because it does not exist", node);
 			continue;
 		}
-	
-		DEBUG_PRINT ("sent to stdin %d", i);
+			
+		DEBUG_PRINT ("sent to stdin [%d] %s", i, node);
 		anjuta_launcher_send_stdin (priv->ctags_launcher, node);
 		anjuta_launcher_send_stdin (priv->ctags_launcher, "\n");
 
@@ -1324,12 +1352,11 @@
 	sdbe->priv = g_new0 (SymbolDBEnginePriv, 1);
 
 	/* initialize some priv data */
-	sdbe->priv->gda_client = NULL;
 	sdbe->priv->db_connection = NULL;
-	sdbe->priv->dsn_name = NULL;
-	sdbe->priv->project_name = NULL;
-	sdbe->priv->data_source = NULL;
-
+	sdbe->priv->sql_parser = NULL;
+	sdbe->priv->db_directory = NULL;
+	sdbe->priv->project_directory = NULL;
+	
 	sdbe->priv->scan_queue = NULL;	
 	sdbe->priv->updated_symbols_id = NULL;
 	sdbe->priv->inserted_symbols_id = NULL;
@@ -1353,7 +1380,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);
 
@@ -1421,9 +1449,6 @@
 	sdbe->priv->garbage_shared_mem_files = g_hash_table_new_full (g_str_hash, g_str_equal, 
 													  g_free, NULL);	
 	
-	/* Initialize gda library. */
-	gda_init ("AnjutaGda", NULL, 0, NULL);
-
 	/* create Anjuta Launcher instance. It will be used for tags parsing. */
 	sdbe->priv->ctags_launcher = NULL;
 }
@@ -1446,8 +1471,6 @@
 	sdb_engine_disconnect_from_db (dbe);
 	sdb_engine_free_cached_queries (dbe);
 	
-	g_free (priv->project_name);
-
 	if (priv->scan_queue)
 	{
 		g_async_queue_unref (priv->scan_queue);
@@ -1458,8 +1481,7 @@
 	{
 		g_async_queue_unref (priv->updated_symbols_id);
 		priv->updated_symbols_id = NULL;
-	}
-	
+	}	
 
 	if (priv->inserted_symbols_id)
 	{
@@ -1471,8 +1493,7 @@
 	{
 		fclose (priv->shared_mem_file);
 		priv->shared_mem_file = NULL; 
-	}
-	
+	}	
 	
 	if (priv->shared_mem_str)
 	{
@@ -1624,13 +1645,26 @@
 	return sdbe;
 }
 
-/* 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 
+/**
+ * Set some default parameters to use with the current database.
+ */
+static void
+sdb_engine_set_defaults_db_parameters (SymbolDBEngine * dbe)
+{	
+	sdb_engine_execute_unknown_sql (dbe, "PRAGMA page_size = 32768");
+	sdb_engine_execute_unknown_sql (dbe, "PRAGMA cache_size = 12288");
+	sdb_engine_execute_unknown_sql (dbe, "PRAGMA synchronous = OFF");
+	sdb_engine_execute_unknown_sql (dbe, "PRAGMA temp_store = MEMORY");
+	sdb_engine_execute_unknown_sql (dbe, "PRAGMA case_sensitive_like = 1");
+}
+
+/* Will create priv->db_connection.
+ * Connect to database identified by db_directory.
+ * Usually db_directory is defined also into priv. We let it here as parameter 
  * because it is required and cannot be null.
  */
 static gboolean
-sdb_engine_connect_to_db (SymbolDBEngine * dbe, const gchar * data_source)
+sdb_engine_connect_to_db (SymbolDBEngine * dbe, const gchar *cnc_string)
 {
 	SymbolDBEnginePriv *priv;
 
@@ -1650,26 +1684,28 @@
 		return FALSE;
 	}
 
-	/* create new client */
-	priv->gda_client = gda_client_new ();
-
 	/* establish a connection. If the sqlite file does not exist it will 
 	 * be created 
 	 */
 	priv->db_connection
-		= gda_client_open_connection (priv->gda_client, data_source,
-									  NULL, NULL,
-									  GDA_CONNECTION_OPTIONS_DONT_SHARE, NULL);	
+		= gda_connection_open_from_string ("SQLite", cnc_string, NULL, 
+										   GDA_CONNECTION_OPTIONS_NONE, NULL);	
 	
 	if (!GDA_IS_CONNECTION (priv->db_connection))
 	{
-		g_warning ("could not open connection to %s\n", data_source);
+		g_warning ("Could not open connection to %s\n", cnc_string);
 		return FALSE;
 	}
 
-	gda_dict_set_connection (default_dict, priv->db_connection);
+	priv->sql_parser = gda_connection_create_parser (priv->db_connection);
+	
+	if (!GDA_IS_SQL_PARSER (priv->sql_parser)) 
+	{
+		g_warning ("Could not create sql parser. Check your libgda installation");
+		return FALSE;
+	}
 	
-	DEBUG_PRINT ("connected to database %s", data_source);
+	DEBUG_PRINT ("connected to database %s", cnc_string);
 	return TRUE;
 }
 
@@ -1679,10 +1715,9 @@
  * @param tables_sql_file File containing sql code.
  */
 static gboolean
-sdb_engine_create_db_tables (SymbolDBEngine * dbe, gchar * tables_sql_file)
+sdb_engine_create_db_tables (SymbolDBEngine * dbe, const gchar * tables_sql_file)
 {
 	GError *err;
-	GdaCommand *command;
 	SymbolDBEnginePriv *priv;
 	gchar *contents;
 	gsize sizez;
@@ -1704,12 +1739,15 @@
 		return FALSE;
 	}
 
+	sdb_engine_execute_non_select_sql (dbe, contents);
+	
+	/*
 	command = gda_command_new (contents, 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);
-
+*/
 	g_free (contents);
 	return TRUE;
 }
@@ -1743,24 +1781,36 @@
 	return TRUE;
 }
 
+gboolean 
+symbol_db_engine_close_db (SymbolDBEngine *dbe)
+{
+	SymbolDBEnginePriv *priv;
+
+	g_return_val_if_fail (dbe != NULL, FALSE);
+	
+	priv = dbe->priv;
+	return sdb_engine_disconnect_from_db (dbe);
+}
+
 /**
  * Open or create a new database at given directory.
  */
 gboolean
-symbol_db_engine_open_db (SymbolDBEngine * dbe, const gchar * prj_directory)
+symbol_db_engine_open_db (SymbolDBEngine * dbe, const gchar * base_db_path,
+						  const gchar * prj_directory)
 {
 	SymbolDBEnginePriv *priv;
-	/* Connection data */
-	gchar *dsn_name;
 	gboolean needs_tables_creation = FALSE;
+	gchar *cnc_string;
 
-	g_return_val_if_fail (prj_directory != NULL, FALSE);
+	g_return_val_if_fail (dbe != NULL, FALSE);
+	g_return_val_if_fail (base_db_path != NULL, FALSE);
 
 	priv = dbe->priv;
 
 	/* check whether the db filename already exists. If it's not the case
 	 * create the tables for the database. */
-	gchar *tmp_file = g_strdup_printf ("%s/%s.db", prj_directory,
+	gchar *tmp_file = g_strdup_printf ("%s/%s.db", base_db_path,
 									   ANJUTA_DB_FILE);
 
 	if (g_file_test (tmp_file, G_FILE_TEST_EXISTS) == FALSE)
@@ -1770,24 +1820,25 @@
 	g_free (tmp_file);
 
 
-	priv->data_source = g_strdup (prj_directory);
+	priv->db_directory = g_strdup (base_db_path);
+	
+	/* save the project_directory */
+	priv->project_directory = g_strdup (prj_directory);
 
-	dsn_name = g_strdup_printf ("DB_DIR=%s;DB_NAME=%s", prj_directory,
+	cnc_string = g_strdup_printf ("DB_DIR=%s;DB_NAME=%s", base_db_path,
 								ANJUTA_DB_FILE);
 
-	if (gda_config_save_data_source (priv->data_source, "SQLite",
-									 dsn_name, "Anjuta Project",
+/*	
+	FIXME: do we really need to save the datasource? 
+	if (gda_config_save_data_source (base_db_path, "SQLite",
+									 cnc_string, "Anjuta Project",
 									 "", "", FALSE) == FALSE)
 	{
 		return FALSE;
 	}
-
-	/* store the dsn name into Priv data. We can avoid to free it here coz it will
-	 * used later again. */
-	priv->dsn_name = dsn_name;
-
+*/
 	DEBUG_PRINT ("symbol_db_engine_open_db (): opening/connecting to database...");
-	sdb_engine_connect_to_db (dbe, priv->data_source);
+	sdb_engine_connect_to_db (dbe, cnc_string);
 
 	if (needs_tables_creation == TRUE)
 	{
@@ -1795,158 +1846,159 @@
 		sdb_engine_create_db_tables (dbe, TABLES_SQL);
 	}
 
+	sdb_engine_set_defaults_db_parameters (dbe);
+	
 	return TRUE;
 }
 
 /**
- * @return -1 on error. Otherwise the id of table
+ * @return -1 on error. Otherwise the id of tuple
  */
 static gint
-sdb_engine_get_table_id_by_unique_name (SymbolDBEngine * dbe, query_type qtype,
+sdb_engine_get_tuple_id_by_unique_name (SymbolDBEngine * dbe, query_type qtype,
 										gchar * param_key,
 										const GValue * param_value)
 {
-	const GdaQuery *query;
-	GdaObject *query_result;
-	GdaParameterList *par_list;
-	GdaParameter *param;
+	GdaSet *plist;
+	const GdaStatement *stmt;
+	GdaHolder *param;
+	GdaDataModel *data_model;
 	const GValue *num;
 	gint table_id;
+	SymbolDBEnginePriv *priv;
+	
+	priv = dbe->priv;
 
 	/* get prepared query */
-	if ((query = sdb_engine_get_query_by_id (dbe, qtype)) == NULL)
-	{
-		g_warning ("query is null");
-		return -1;
-	}
-
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL
-		== gda_query_get_query_type ((GdaQuery *) query))
+	if ((stmt = sdb_engine_get_query_by_id (dbe, qtype)) == NULL)
 	{
-		g_warning ("sdb_engine_get_table_id_by_unique_name: non parsed "
-				   "sql error");
+		g_warning ("Query is null");
 		return -1;
 	}
 
-	if ((par_list = gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
+	if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
 	{
-		g_warning ("par_list is NULL!\n");
+		g_warning ("Error on getting parameters");
 		return -1;
 	}
-
-	if ((param = gda_parameter_list_find_param (par_list, param_key)) == NULL)
+	
+	if ((param = gda_set_get_holder (plist, param_key)) == NULL)
 	{
-		g_warning ("sdb_engine_get_table_id_by_unique_name: param is NULL "
+		g_warning ("sdb_engine_get_tuple_id_by_unique_name: param is NULL "
 				   "from pquery!\n");
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_parameter_set_value (param, param_value);
-
+	gda_holder_set_value (param, param_value);
+	
 	/* execute the query with parametes just set */
-	query_result = gda_query_execute ((GdaQuery *) query, par_list, FALSE,
-									 NULL);
-
-	if (!GDA_IS_DATA_MODEL (query_result) ||
-		gda_data_model_get_n_rows (GDA_DATA_MODEL (query_result)) <= 0)
-	{
-		if (query_result != NULL)
-			g_object_unref (query_result);
+	data_model = gda_connection_statement_execute_select (priv->db_connection, 
+														  (GdaStatement*)stmt, 
+														  plist, NULL);
+		
+	if (!GDA_IS_DATA_MODEL (data_model) ||
+		gda_data_model_get_n_rows (GDA_DATA_MODEL (data_model)) <= 0)
+	{
+		if (data_model != NULL)
+			g_object_unref (data_model);
+		g_object_unref (plist);
 		return -1;
 	}
 
 	/* get and parse the results. */
-	num = gda_data_model_get_value_at (GDA_DATA_MODEL (query_result), 0, 0);
+	num = gda_data_model_get_value_at (GDA_DATA_MODEL (data_model), 0, 0);
 
 	table_id = g_value_get_int (num);
-	g_object_unref (query_result);
+	g_object_unref (data_model);
+	g_object_unref (plist);
 	return table_id;
 }
 
 /**
- * This is the same as sdb_engine_get_table_id_by_unique_name () but for two
+ * This is the same as sdb_engine_get_tuple_id_by_unique_name () but for two
  * unique parameters. This should be the quickest way. Surely quicker than
  * use g_strdup_printf () with a va_list for example.
  * @return -1 on error. Otherwise the id of table
  *
  */
 static gint
-sdb_engine_get_table_id_by_unique_name2 (SymbolDBEngine * dbe, query_type qtype,
+sdb_engine_get_tuple_id_by_unique_name2 (SymbolDBEngine * dbe, query_type qtype,
 										 gchar * param_key1,
 										 const GValue * value1,
 										 gchar * param_key2,
 										 const GValue * value2)
 {
-	const GdaQuery *query;
-	GdaObject *query_result;
-	GdaParameterList *par_list;
-	GdaParameter *param;
+	GdaSet *plist;
+	const GdaStatement *stmt;
+	GdaHolder *param;
+	GdaDataModel *data_model;
 	const GValue *num;
 	gint table_id;
+	SymbolDBEnginePriv *priv;
+	
+	priv = dbe->priv;
 
 	/* get prepared query */
-	if ((query = sdb_engine_get_query_by_id (dbe, qtype)) == NULL)
-	{
-		g_warning ("query is null");
-		return -1;
-	}
-
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL
-		== gda_query_get_query_type ((GdaQuery *) query))
+	if ((stmt = sdb_engine_get_query_by_id (dbe, qtype)) == NULL)
 	{
-		g_warning
-			("sdb_engine_get_table_id_by_unique_name2: non parsed sql error");
+		g_warning ("Query is null");
 		return -1;
 	}
 
-	if ((par_list = gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
+	if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
 	{
-		g_warning ("par_list is NULL!\n");
+		g_warning ("Error on getting parameters");
 		return -1;
 	}
 
 	/* look for and set the first parameter */
-	if ((param = gda_parameter_list_find_param (par_list, param_key1)) == NULL)
+	if ((param = gda_set_get_holder (plist, param_key1)) == NULL)
 	{
-		g_warning ("sdb_engine_get_table_id_by_unique_name2: "
+		g_warning ("sdb_engine_get_tuple_id_by_unique_name2: "
 				   "param is NULL from pquery! [par1: %s] [par2: %s]\n",
 				   param_key1, param_key2);
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_parameter_set_value (param, value1);
-
+	gda_holder_set_value (param, value1);
+	
 	/* ...and the second one */
-	if ((param = gda_parameter_list_find_param (par_list, param_key2)) == NULL)
+	if ((param = gda_set_get_holder (plist, param_key2)) == NULL)
 	{
-		g_warning ("param is NULL from pquery!\n");
+		g_warning ("sdb_engine_get_tuple_id_by_unique_name2: "
+				   "param is NULL from pquery! [par1: %s] [par2: %s]\n",
+				   param_key1, param_key2);
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_parameter_set_value (param, value2);
+	gda_holder_set_value (param, value2);
 
 	/* execute the query with parametes just set */
-	query_result = gda_query_execute ((GdaQuery *) query, par_list, 
-												  FALSE, NULL);
-
-	if (!GDA_IS_DATA_MODEL (query_result) ||
-		((gda_data_model_get_n_rows (GDA_DATA_MODEL (query_result))) <= 0))
-	{
-		if (query_result != NULL)
-			g_object_unref (query_result);
+	data_model = gda_connection_statement_execute_select (priv->db_connection, 
+														  (GdaStatement*)stmt, 
+														  plist, NULL);
+		
+	if (!GDA_IS_DATA_MODEL (data_model) ||
+		gda_data_model_get_n_rows (GDA_DATA_MODEL (data_model)) <= 0)
+	{
+		if (data_model != NULL)
+			g_object_unref (data_model);
+		g_object_unref (plist);
 		return -1;
 	}
 
 	/* get and parse the results. */
-	num = gda_data_model_get_value_at (GDA_DATA_MODEL (query_result), 0, 0);
+	num = gda_data_model_get_value_at (GDA_DATA_MODEL (data_model), 0, 0);
 
 	table_id = g_value_get_int (num);
-	g_object_unref (query_result);
+	g_object_unref (data_model);
+	g_object_unref (plist);
+	
 	return table_id;
 }
 
 static gint
-sdb_engine_get_table_id_by_unique_name3 (SymbolDBEngine * dbe, query_type qtype,
+sdb_engine_get_tuple_id_by_unique_name3 (SymbolDBEngine * dbe, query_type qtype,
 										 gchar * param_key1,
 										 const GValue * value1,
 										 gchar * param_key2,
@@ -1954,82 +2006,81 @@
 										 gchar * param_key3,
 										 const GValue * value3)
 {
-	const GdaQuery *query;
-	GdaObject *query_result;
-	GdaParameterList *par_list;
-	GdaParameter *param;
+	GdaSet *plist;
+	const GdaStatement *stmt;
+	GdaHolder *param;
+	GdaDataModel *data_model;
 	const GValue *num;
 	gint table_id;
+	SymbolDBEnginePriv *priv;
+	
+	priv = dbe->priv;
 
 	/* get prepared query */
-	if ((query = sdb_engine_get_query_by_id (dbe, qtype)) == NULL)
+	if ((stmt = sdb_engine_get_query_by_id (dbe, qtype)) == NULL)
 	{
-		g_warning ("query is null");
+		g_warning ("Query is null");
 		return -1;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL
-		== gda_query_get_query_type ((GdaQuery *) query))
+	if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
 	{
-		g_warning
-			("sdb_engine_get_table_id_by_unique_name2: non parsed sql error");
+		g_warning ("Error on getting parameters");
 		return -1;
 	}
-
-	if ((par_list = gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
+	
+	if ((param = gda_set_get_holder (plist, param_key1)) == NULL)
 	{
-		g_warning ("par_list is NULL!\n");
+		g_warning ("sdb_engine_get_tuple_id_by_unique_name: param is NULL "
+				   "from pquery!\n");
+		g_object_unref (plist);
 		return -1;
 	}
+	gda_holder_set_value (param, value1);
+	
 
-	/* look for and set the first parameter */
-	if ((param = gda_parameter_list_find_param (par_list, param_key1)) == NULL)
+	/* ...and the second one */
+	if ((param = gda_set_get_holder (plist, param_key2)) == NULL)
 	{
-		g_warning ("sdb_engine_get_table_id_by_unique_name2: "
+		g_warning ("sdb_engine_get_tuple_id_by_unique_name2: "
 				   "param is NULL from pquery! [par1: %s] [par2: %s]\n",
 				   param_key1, param_key2);
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_parameter_set_value (param, value1);
-
-	/* ...and the second one */
-	if ((param = gda_parameter_list_find_param (par_list, param_key2)) == NULL)
-	{
-		g_warning ("param is NULL from pquery!\n");
-		return -1;
-	}
-
-	gda_parameter_set_value (param, value2);
+	gda_holder_set_value (param, value2);
 
 	/* ...and the third one */
-	if ((param = gda_parameter_list_find_param (par_list, param_key3)) == NULL)
+	if ((param = gda_set_get_holder (plist, param_key3)) == NULL)
 	{
-		g_warning ("param is NULL from pquery!\n");
+		g_warning ("sdb_engine_get_tuple_id_by_unique_name2: "
+				   "param is NULL from pquery! [par1: %s] [par2: %s]\n",
+				   param_key1, param_key3);
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_parameter_set_value (param, value3);
-
-
+	gda_holder_set_value (param, value3);
+		
 	/* execute the query with parametes just set */
-	query_result = gda_query_execute ((GdaQuery *) query, par_list, 
-												 FALSE, NULL);
-
-	if (!GDA_IS_DATA_MODEL (query_result) ||
-		gda_data_model_get_n_rows (GDA_DATA_MODEL (query_result)) <= 0)
-	{
-
-		if (query_result != NULL)
-			g_object_unref (query_result);
+	data_model = gda_connection_statement_execute_select (priv->db_connection, 
+														  (GdaStatement*)stmt, 
+														  plist, NULL);
+		
+	if (!GDA_IS_DATA_MODEL (data_model) ||
+		gda_data_model_get_n_rows (GDA_DATA_MODEL (data_model)) <= 0)
+	{
+		if (data_model != NULL)
+			g_object_unref (data_model);
+		g_object_unref (plist);
 		return -1;
 	}
 
 	/* get and parse the results. */
-	num = gda_data_model_get_value_at (GDA_DATA_MODEL (query_result), 0, 0);
+	num = gda_data_model_get_value_at (GDA_DATA_MODEL (data_model), 0, 0);
 
 	table_id = g_value_get_int (num);
-	g_object_unref (query_result);
+	g_object_unref (data_model);
+	g_object_unref (plist);
 	return table_id;
 }
 
@@ -2044,90 +2095,59 @@
                         analyse_time DATE
                         );
 */
-	const GdaQuery *query;
-	GdaObject *query_result;
-	GdaParameterList *par_list;
-	GdaParameter *param;	
-	GValue *value;
+	GdaSet *plist;
+	const GdaStatement *stmt;
+	GdaHolder *param;
 	SymbolDBEnginePriv *priv;
 
+	g_return_val_if_fail (dbe != NULL, FALSE);	
 	priv = dbe->priv;
 
 	g_return_val_if_fail (priv->db_connection != NULL, FALSE);
 
-	if ((query =
+	if ((stmt =
 		 sdb_engine_get_query_by_id (dbe, PREP_QUERY_WORKSPACE_NEW)) == NULL)
 	{
 		g_warning ("query is null");
 		return FALSE;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query))
-	{
-		g_warning ("non parsed sql error");
-		return FALSE;
-	}
-
-	if ((par_list = gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
+	if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
 	{
-		g_warning ("par_list is NULL!\n");
+		g_warning ("Error on getting parameters");
 		return FALSE;
 	}
+	
 
-	if ((param = gda_parameter_list_find_param (par_list, "wsname")) == NULL)
+	if ((param = gda_set_get_holder (plist, "wsname")) == NULL)
 	{
 		g_warning ("param is NULL from pquery!\n");
+		g_object_unref (plist);
 		return FALSE;
 	}
-
-	value = gda_value_new (G_TYPE_STRING);
-	g_value_set_string (value, workspace_name);
-
-	gda_parameter_set_value (param, value);
-
+	gda_holder_set_value_str (param, NULL, workspace_name);
+	
 	/* execute the query with parametes just set */
 	GError *err = NULL;
-	query_result = 
-		gda_query_execute ((GdaQuery *) query, par_list, FALSE, &err);
-	gda_value_free (value);
-
-		
-	if (query_result != NULL) 
-	{
-		g_object_unref (query_result);
-		return TRUE;
-	}
-	else 
-	{
+	if (gda_connection_statement_execute_non_select (priv->db_connection, 
+														  (GdaStatement*)stmt, 
+														  plist, NULL, &err) == -1)
+	{		
 		DEBUG_PRINT ("Error: %s", err->message);
+		g_object_unref (plist);
 		return FALSE;
 	}
-}
 
-/**
- * Return the name of the opened project.
- * NULL on error. Returned string must be freed by caller.
- */
-gchar*
-symbol_db_engine_get_opened_project_name (SymbolDBEngine * dbe)
-{
-	SymbolDBEnginePriv *priv;
-	g_return_val_if_fail (dbe != NULL, NULL);
-	priv = dbe->priv;
-	
-	g_return_val_if_fail (priv->db_connection != NULL, NULL);
-	
-	return g_strdup (priv->project_name);
+	g_object_unref (plist);
+	return TRUE;
 }
 
 /**
- * Open a new project.
- * It will test if project was correctly created. 
+ * Test it project_name is created in the opened database
  */
 gboolean
-symbol_db_engine_open_project (SymbolDBEngine * dbe,	/*gchar* workspace, */
-							   const gchar * project_name)
+symbol_db_engine_project_exists (SymbolDBEngine * dbe,	/*gchar* workspace, */
+							   	const gchar * project_name)
 {
 	GValue *value;
 	SymbolDBEnginePriv *priv;
@@ -2136,18 +2156,11 @@
 	priv = dbe->priv;
 
 	g_return_val_if_fail (priv->db_connection != NULL, FALSE);
-	if (symbol_db_engine_is_project_opened (dbe, project_name) == TRUE) {
-		g_warning ("symbol_db_engine_open_project (): "
-				   "project already opened, %s (priv %s)", project_name, 
-				   priv->project_name);
-		return FALSE;
-	}
-
 	value = gda_value_new (G_TYPE_STRING);
 	g_value_set_string (value, project_name);
 
 	/* test the existence of the project in db */
-	if ((prj_id = sdb_engine_get_table_id_by_unique_name (dbe,
+	if ((prj_id = sdb_engine_get_tuple_id_by_unique_name (dbe,
 				PREP_QUERY_GET_PROJECT_ID_BY_UNIQUE_NAME,
 				"prjname",
 				 value)) <= 0)
@@ -2159,27 +2172,11 @@
 
 	gda_value_free (value);
 
-	/* open the project... */
-	priv->project_name = g_strdup (project_name);
-
+	/* we found it */
 	return TRUE;
 }
 
 
-gboolean 
-symbol_db_engine_close_project (SymbolDBEngine *dbe, const gchar* project_name)
-{
-	SymbolDBEnginePriv *priv;
-
-	priv = dbe->priv;
-
-	g_free (priv->project_name);
-	priv->project_name = NULL;				
-
-	return sdb_engine_disconnect_from_db (dbe);
-}
-
-
 /**
  * @param workspace Can be NULL. In that case a default workspace will be created, 
  * 					and project will depend on that.
@@ -2196,34 +2193,26 @@
                       analyse_time DATE
                       );
 */
-	const GdaQuery *query;
-	GdaObject *query_result;
-	GdaParameterList *par_list;
-	GdaParameter *param;
+	GdaSet *plist;
+	const GdaStatement *stmt;
+	GdaHolder *param;
 	GValue *value;
 	const gchar *workspace_name;
 	gint wks_id;
 	SymbolDBEnginePriv *priv;
 
-	g_return_val_if_fail (dbe != NULL, FALSE);
-	
+	g_return_val_if_fail (dbe != NULL, FALSE);	
 	priv = dbe->priv;
 
-	if (symbol_db_engine_is_project_opened (dbe, project) == TRUE) 
-	{
-		g_warning ("You have an already opened project. Cannot continue.");
-		return FALSE;
-	}
-	
-	if (workspace == NULL)
+	if (workspace == NULL)
 	{
 		workspace_name = "anjuta_workspace_default";	
 		
-		DEBUG_PRINT ("adding default workspace... %s", workspace_name);
+		DEBUG_PRINT ("adding default workspace... '%s'", workspace_name);
 		value = gda_value_new (G_TYPE_STRING);
 		g_value_set_string (value, workspace_name);
 		
-		if ((wks_id = sdb_engine_get_table_id_by_unique_name (dbe,
+		if ((wks_id = sdb_engine_get_tuple_id_by_unique_name (dbe,
 				 PREP_QUERY_GET_WORKSPACE_ID_BY_UNIQUE_NAME,
 				 "wsname",
 				 value)) <= 0)
@@ -2247,7 +2236,7 @@
 	g_value_set_string (value, workspace_name);
 
 	/* get workspace id */
-	if ((wks_id = sdb_engine_get_table_id_by_unique_name (dbe,
+	if ((wks_id = sdb_engine_get_tuple_id_by_unique_name (dbe,
 				 PREP_QUERY_GET_WORKSPACE_ID_BY_UNIQUE_NAME,
 				 "wsname",
 				 value)) <= 0)
@@ -2256,65 +2245,56 @@
 		gda_value_free (value);
 		return FALSE;
 	}
-
+	gda_value_free (value);
+	
 	/* insert new project */
-	if ((query =
+	if ((stmt =
 		 sdb_engine_get_query_by_id (dbe, PREP_QUERY_PROJECT_NEW)) == NULL)
 	{
 		g_warning ("query is null");
-		gda_value_free (value);
 		return FALSE;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query))
+	if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
 	{
-		g_warning ("non parsed sql error");
-		gda_value_free (value);
+		g_warning ("Error on getting parameters");
 		return FALSE;
 	}
 
-	if ((par_list = gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
+	/* lookup parameters */
+	if ((param = gda_set_get_holder (plist, "prjname")) == NULL)
 	{
-		g_warning ("par_list is NULL!\n");
-		gda_value_free (value);
+		g_warning ("param prjname is NULL from pquery!");
+		g_object_unref (plist);
 		return FALSE;
 	}
-
-	if ((param = gda_parameter_list_find_param (par_list, "prjname")) == NULL)
+	gda_holder_set_value_str (param, NULL, project);
+		
+	if ((param = gda_set_get_holder (plist, "wsid")) == NULL)
 	{
 		g_warning ("param prjname is NULL from pquery!");
-		gda_value_free (value);
+		g_object_unref (plist);
 		return FALSE;
 	}
-
-	gda_value_reset_with_type (value, G_TYPE_STRING);
-	g_value_set_string (value, project);
-	gda_parameter_set_value (param, value);
-
-	if ((param = gda_parameter_list_find_param (par_list, "wsid")) == NULL)
-	{
-		g_warning ("param is NULL from pquery!");
+	value = gda_value_new (G_TYPE_INT);
+	g_value_set_int (value, wks_id);	
+	gda_holder_set_value (param, value);
+		
+	/* execute the query with parametes just set */
+	GError *err = NULL;
+	if (gda_connection_statement_execute_non_select (priv->db_connection, 
+														  (GdaStatement*)stmt, 
+														  plist, NULL, &err) == -1)
+	{		
+		DEBUG_PRINT ("Error: %s", err->message);
+		gda_value_free (value);
+		g_object_unref (plist);
 		return FALSE;
 	}
-
-	gda_value_reset_with_type (value, G_TYPE_INT);
-	g_value_set_int (value, wks_id);
-
-	gda_parameter_set_value (param, value);
-
-	/* execute the query with parametes just set */
-	query_result =
-		gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
-	gda_value_free (value);
+	gda_value_free (value);	
+	g_object_unref (plist);
 	
-	if (query_result != NULL)
-	{
-		g_object_unref (query_result);
-		return TRUE;
-	}
-	else
-		return FALSE;
+	return TRUE;
 }
 
 
@@ -2327,74 +2307,67 @@
 */
 	gint table_id;
 	GValue *value;
-
+	SymbolDBEnginePriv *priv;
+		
 	g_return_val_if_fail (language != NULL, -1);
 
+	priv = dbe->priv;
+	
 	value = gda_value_new (G_TYPE_STRING);
 	g_value_set_string (value, language);
 
 	/* check for an already existing table with language "name". */
-	if ((table_id = sdb_engine_get_table_id_by_unique_name (dbe,
+	if ((table_id = sdb_engine_get_tuple_id_by_unique_name (dbe,
 						PREP_QUERY_GET_LANGUAGE_ID_BY_UNIQUE_NAME,
 						"langname",
 						value)) < 0)
 	{
-
 		/* insert a new entry on db */
-		const GdaQuery *query;
-		GdaObject *query_result;
-		GdaParameterList *par_list;
-		GdaParameter *param;
-		GValue *value;
+		GdaSet *plist;
+		const GdaStatement *stmt;
+		GdaHolder *param;
+		GdaSet *last_inserted;
 
-		if ((query = sdb_engine_get_query_by_id (dbe, PREP_QUERY_LANGUAGE_NEW))
+		if ((stmt = sdb_engine_get_query_by_id (dbe, PREP_QUERY_LANGUAGE_NEW))
 			== NULL)
 		{
 			g_warning ("query is null");
 			return FALSE;
 		}
 
-		if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-			gda_query_get_query_type ((GdaQuery *) query))
-		{
-			g_warning ("non parsed sql error");
-			return FALSE;
-		}
-
-		if ((par_list =
-			 gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
-		{
+		if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
+		{		
 			g_warning ("par_list is NULL!\n");
 			return FALSE;
 		}
 
-		if ((param =
-			 gda_parameter_list_find_param (par_list, "langname")) == NULL)
+		if ((param = gda_set_get_holder (plist, "langname")) == NULL)
 		{
 			g_warning ("param langname is NULL from pquery!");
+			g_object_unref (plist);
 			return FALSE;
 		}
-
-		value = gda_value_new (G_TYPE_STRING);
-		g_value_set_string (value, language);
-
-		gda_parameter_set_value (param, value);
-		gda_value_free (value);
+		gda_holder_set_value_str (param, NULL, language);
+		
+		GError *err = NULL;
 		/* execute the query with parametes just set */
-		query_result =
-			gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
-
-		if (query_result != NULL)
-		{
-			table_id = sdb_engine_get_last_insert_id (dbe);
-			g_object_unref (query_result);
-		}
-		else 
-		{
+		if (gda_connection_statement_execute_non_select (priv->db_connection, 
+														 (GdaStatement*)stmt, 
+														 plist, &last_inserted,
+														 &err) == -1)
+		{		
+			DEBUG_PRINT ("Error: %s", err->message);
 			table_id = -1;
 		}
+		else {
+			const GValue *value = gda_set_get_holder_value (last_inserted, "+0");
+			table_id = g_value_get_int (value);
+		}
+		
+		g_object_unref (plist);
 	}
-	gda_value_free (value);
+	gda_value_free (value);	
+	
 	return table_id;
 }
 
@@ -2403,11 +2376,17 @@
  * This function requires an opened db, i.e. calling before
  * symbol_db_engine_open_db ()
  * filepath: referes to a full file path.
- * WARNING: we suppose that project is already opened.
+ * project: 
+ * WARNING: we suppose that project_directory is already set.
+ * WARNING2: we suppose that the given local_filepath include the project_directory path.
+ * + correct example: local_filepath: /home/user/projects/foo_project/src/main.c
+ *                    project_directory: /home/user/projects/foo_project
+ * - wrong one: local_filepath: /tmp/foo.c
+ *                    project_directory: /home/user/projects/foo_project
  */
 static gboolean
-sdb_engine_add_new_file (SymbolDBEngine * dbe, const gchar * project,
-						 const gchar * filepath, const gchar * language)
+sdb_engine_add_new_file (SymbolDBEngine * dbe, const gchar * project_name,
+						 const gchar * local_filepath, const gchar * language)
 {
 /*
 CREATE TABLE file (file_id integer PRIMARY KEY AUTOINCREMENT,
@@ -2424,12 +2403,19 @@
 	GValue *value;
 	
 	priv = dbe->priv;
+
+	/* check if the file is a correct one compared to the local_filepath */
+	if (strstr (local_filepath, priv->project_directory) == NULL)
+		return FALSE;
+	
+	DEBUG_PRINT ("sdb_engine_add_new_file project_name %s local_filepath %s language %s",
+				 project_name, local_filepath, language);
 	
 	value = gda_value_new (G_TYPE_STRING);
-	g_value_set_string (value, project);
+	g_value_set_string (value, project_name);
 
 	/* check for an already existing table with project "project". */
-	if ((project_id = sdb_engine_get_table_id_by_unique_name (dbe,
+	if ((project_id = sdb_engine_get_tuple_id_by_unique_name (dbe,
 								  PREP_QUERY_GET_PROJECT_ID_BY_UNIQUE_NAME,
 								  "prjname",
 								  value)) < 0)
@@ -2442,129 +2428,93 @@
 	gda_value_free (value);
 	value = gda_value_new (G_TYPE_STRING);
 	/* we're gonna set the file relative to the project folder, not the full one.
-	 * e.g.: we have a file on disk: "/tmp/foo/src/file.c" and a datasource located on
+	 * e.g.: we have a file on disk: "/tmp/foo/src/file.c" and a db_directory located on
 	 * "/tmp/foo/". The entry on db will be "/src/file.c" 
 	 */
-	g_value_set_string (value, filepath + strlen(priv->data_source));
+	g_value_set_string (value, local_filepath + strlen (priv->project_directory));
 
-	if ((file_id = sdb_engine_get_table_id_by_unique_name (dbe,
+	if ((file_id = sdb_engine_get_tuple_id_by_unique_name (dbe,
 								   PREP_QUERY_GET_FILE_ID_BY_UNIQUE_NAME,
 								   "filepath",
 								   value)) < 0)
 	{
 		/* insert a new entry on db */
-		const GdaQuery *query;
-		GdaObject *query_result;
-		GdaParameterList *par_list;
-		GdaParameter *param;
+		GdaSet *plist;
+		const GdaStatement *stmt;
+		GdaHolder *param;
 		GValue *value;
 
 		language_id = sdb_engine_add_new_language (dbe, language);
 
-		if ((query = sdb_engine_get_query_by_id (dbe, PREP_QUERY_FILE_NEW))
+		if ((stmt = sdb_engine_get_query_by_id (dbe, PREP_QUERY_FILE_NEW))
 			== NULL)
 		{
 			g_warning ("query is null");
 			return FALSE;
 		}
 
-		if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-			gda_query_get_query_type ((GdaQuery *) query))
-		{
-			g_warning ("non parsed sql error");
-			return FALSE;
-		}
-
-		if ((par_list =
-			 gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
-		{
+		if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
+		{		
 			g_warning ("par_list is NULL!\n");
 			return FALSE;
 		}
-
+		
 		/* filepath parameter */
-		if ((param =
-			 gda_parameter_list_find_param (par_list, "filepath")) == NULL)
+		if ((param = gda_set_get_holder (plist, "filepath")) == NULL)
 		{
-			g_warning ("param filepath is NULL from pquery!");
+			g_warning ("param langname is NULL from pquery!");
+			g_object_unref (plist);
 			return FALSE;
 		}
-
-		value = gda_value_new (G_TYPE_STRING);
-		/* relative filepath */
-		g_value_set_string (value, filepath + strlen(priv->data_source));
-		gda_parameter_set_value (param, value);
+		gda_holder_set_value_str (param, NULL, local_filepath + 
+								  strlen(priv->project_directory));
 
 		/* project id parameter */
-		if ((param = gda_parameter_list_find_param (par_list, "prjid")) == NULL)
+		if ((param = gda_set_get_holder (plist, "prjid")) == NULL)
 		{
 			g_warning ("param prjid is NULL from pquery!");
+			g_object_unref (plist);
 			return FALSE;
 		}
-
-		gda_value_reset_with_type (value, G_TYPE_INT);
+		value = gda_value_new (G_TYPE_INT);
 		g_value_set_int (value, project_id);
-		gda_parameter_set_value (param, value);
+		gda_holder_set_value (param, value);
 
 		/* language id parameter */
-		if ((param =
-			 gda_parameter_list_find_param (par_list, "langid")) == NULL)
+		if ((param = gda_set_get_holder (plist, "langid")) == NULL)
 		{
 			g_warning ("param langid is NULL from pquery!");
+			g_object_unref (plist);
 			return FALSE;
 		}
 
 		gda_value_reset_with_type (value, G_TYPE_INT);
 		g_value_set_int (value, language_id);
-		gda_parameter_set_value (param, value);
+		gda_holder_set_value (param, value);
 		gda_value_free (value);
 
 		/* execute the query with parametes just set */
-		query_result = gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
+		GError *err = NULL;
+		if (gda_connection_statement_execute_non_select (priv->db_connection, 
+														 (GdaStatement*)stmt, 
+														 plist, NULL,
+														 &err) == -1)
+		{		
+			DEBUG_PRINT ("Error: %s", err->message);
+			g_object_unref (plist);
+			return FALSE;
+		}	
 		
-		if (query_result != NULL)
-			g_object_unref (query_result);
+		g_object_unref (plist);
 	}
-	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);
+	gda_value_free (value);	
 	
-	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);
-}
+	return TRUE;
+} 
 
 gboolean
-symbol_db_engine_add_new_files (SymbolDBEngine * dbe, const gchar * project,
+symbol_db_engine_add_new_files (SymbolDBEngine * dbe, 
+								const gchar * project_name,
 								const GPtrArray * files_path, 
 								const GPtrArray * languages,
 								gboolean scan_symbols)
@@ -2576,19 +2526,10 @@
 	priv = dbe->priv;
 
 	g_return_val_if_fail (priv->db_connection != NULL, FALSE);
-	g_return_val_if_fail (project != NULL, FALSE);
+	g_return_val_if_fail (project_name != NULL, FALSE);
+	g_return_val_if_fail (files_path->len > 0, FALSE);
+	g_return_val_if_fail (languages->len > 0, 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, 
-				   priv->project_name);
-		return FALSE;
-	}	
-	
 	for (i = 0; i < files_path->len; i++)
 	{
 		gchar *node = (gchar *) g_ptr_array_index (files_path, i);
@@ -2597,13 +2538,16 @@
 		/* test the existance of node file */
 		if (g_file_test (node, G_FILE_TEST_EXISTS) == FALSE)
 		{
-			g_warning ("File %s doesn't exist", node);
+			g_warning ("File %s does NOT exist", node);
 			continue;
 		}
 			
-		if (sdb_engine_add_new_file (dbe, project, node, node_lang) == FALSE)
+		if (sdb_engine_add_new_file (dbe, project_name, node, 
+									 node_lang) == FALSE)
 		{
-			g_warning ("Error processing file %s", node);
+			g_warning ("Error processing file %s, db_directory %s, project_name %s, "
+					   "project_directory %s", node, 
+					   priv->db_directory, project_name, priv->project_directory);
 			return FALSE;
 		}
 	}
@@ -2632,75 +2576,56 @@
 */
 	const gchar *type;
 	const gchar *type_name;
-	gint table_id;
+	gint table_id;	
+	GdaSet *plist;
+	const GdaStatement *stmt;
+	GdaHolder *param;
+	GdaSet *last_inserted;
+	SymbolDBEnginePriv *priv;
 	
-	const GdaQuery *query;
-	GdaObject * query_result;
-	GdaParameterList *par_list;
-	GdaParameter *param;
-	GValue *value;
-
-	g_return_val_if_fail (tag_entry != NULL, -1);
-
+	priv = dbe->priv;
+	
+	/* we assume that tag_entry is != NULL */
 	type = tag_entry->kind;
 	type_name = tag_entry->name;
 	
 	/* it does not exist. Create a new tuple. */
-	if ((query = sdb_engine_get_query_by_id (dbe, PREP_QUERY_SYM_TYPE_NEW))
+	if ((stmt = sdb_engine_get_query_by_id (dbe, PREP_QUERY_SYM_TYPE_NEW))
 		== NULL)
 	{
 		g_warning ("query is null");
 		return -1;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query))
-	{
-		g_warning ("non parsed sql error");
-		return -1;
-	}
-
-	if ((par_list =
-		 gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
-	{
+	if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
+	{		
 		g_warning ("par_list is NULL!\n");
 		return -1;
 	}
 
 	/* type parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "type")) == NULL)
+	if ((param = gda_set_get_holder (plist, "type")) == NULL)
 	{
 		g_warning ("param type is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
-
-	value = gda_value_new (G_TYPE_STRING);
-	g_value_set_string (value, type);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value_str (param, NULL, type);
 
 	/* type_name parameter */
-	if ((param =
-		 gda_parameter_list_find_param (par_list, "typename")) == NULL)
+	if ((param = gda_set_get_holder (plist, "typename")) == NULL)
 	{
 		g_warning ("param typename is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_value_reset_with_type (value, G_TYPE_STRING);
-	g_value_set_string (value, type_name);
-	gda_parameter_set_value (param, value);
-	gda_value_free (value);
+	gda_holder_set_value_str (param, NULL, type_name);
 
 	/* execute the query with parametes just set */
-	query_result = 
-		gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
-
-	if (query_result != NULL)
-	{				
-		g_object_unref (query_result);
-		table_id = sdb_engine_get_last_insert_id (dbe);
-	}
-	else
+	if (gda_connection_statement_execute_non_select (priv->db_connection, 
+													 (GdaStatement*)stmt, 
+													 plist, &last_inserted,
+													 NULL) == -1)
 	{
 		GValue *value1, *value2;
 
@@ -2710,19 +2635,27 @@
 		value2 = gda_value_new (G_TYPE_STRING);
 		g_value_set_string (value2, type_name);
 
-		if ((table_id = sdb_engine_get_table_id_by_unique_name2 (dbe,
+		if ((table_id = sdb_engine_get_tuple_id_by_unique_name2 (dbe,
 													 PREP_QUERY_GET_SYM_TYPE_ID,
 													 "type", value1,
-													 "typename",
-													 value2)) < 0)
+													 "typename", value2)) < 0)
 		{
 			table_id = -1;
 		}
 
 		gda_value_free (value1);
 		gda_value_free (value2);
+		g_object_unref (plist);
 		
-	}
+		return table_id;
+	}	
+	else 
+	{
+		const GValue *value = gda_set_get_holder_value (last_inserted, "+0");
+		table_id = g_value_get_int (value);
+	}		
+	
+	g_object_unref (plist);
 	return table_id;
 }
 
@@ -2737,9 +2670,11 @@
 	const gchar *kind_name;
 	gint table_id;
 	GValue *value;
+	SymbolDBEnginePriv *priv;
+	
+	priv = dbe->priv;
 
-	g_return_val_if_fail (tag_entry != NULL, -1);
-
+	/* we assume that tag_entry is != NULL */
 	kind_name = tag_entry->kind;
 
 	/* no kind associated with current tag */
@@ -2749,67 +2684,58 @@
 	value = gda_value_new (G_TYPE_STRING);
 	g_value_set_string (value, kind_name);
 
-	if ((table_id = sdb_engine_get_table_id_by_unique_name (dbe,
+	if ((table_id = sdb_engine_get_tuple_id_by_unique_name (dbe,
 										PREP_QUERY_GET_SYM_KIND_BY_UNIQUE_NAME,
 										"kindname",
 										value)) < 0)
 	{
-		const GdaQuery *query;
-		GdaObject *query_result;
-		GdaParameterList *par_list;
-		GdaParameter *param;
-		GValue *value;
+		GdaSet *plist;
+		const GdaStatement *stmt;
+		GdaHolder *param;
+		GdaSet *last_inserted;
 
 		/* not found. Go on with inserting  */
-		if ((query = sdb_engine_get_query_by_id (dbe, PREP_QUERY_SYM_KIND_NEW))
+		if ((stmt = sdb_engine_get_query_by_id (dbe, PREP_QUERY_SYM_KIND_NEW))
 			== NULL)
 		{
 			g_warning ("query is null");
 			return -1;
 		}
 
-		if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-			gda_query_get_query_type ((GdaQuery *) query))
-		{
-			g_warning ("non parsed sql error");
-			return -1;
-		}
-
-		if ((par_list =
-			 gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
-		{
+		if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
+		{		
 			g_warning ("par_list is NULL!\n");
 			return -1;
 		}
-
+		
 		/* kindname parameter */
-		if ((param =
-			 gda_parameter_list_find_param (par_list, "kindname")) == NULL)
+		if ((param = gda_set_get_holder (plist, "kindname")) == NULL)
 		{
 			g_warning ("param kindname is NULL from pquery!");
-			return -1;
+			g_object_unref (plist);
+			return FALSE;
 		}
+		gda_holder_set_value_str (param, NULL, kind_name);
 
-		value = gda_value_new (G_TYPE_STRING);
-		g_value_set_string (value, kind_name);
-		gda_parameter_set_value (param, value);
-		gda_value_free (value);
-
+	
 		/* execute the query with parametes just set */
-		query_result = 
-			gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
-
-		if (query_result != NULL)
-		{
-			table_id = sdb_engine_get_last_insert_id (dbe);
-			g_object_unref (query_result);
-		}
-		else 
+		GError *err = NULL;
+		if (gda_connection_statement_execute_non_select (priv->db_connection, 
+														 (GdaStatement*)stmt, 
+														 plist, &last_inserted,
+														 &err) == -1)
+		{		
+			table_id = -1;		
+		}			
+		else
 		{
-			table_id = -1;
+			const GValue *value = gda_set_get_holder_value (last_inserted, "+0");
+			table_id = g_value_get_int (value);
 		}
+		g_object_unref (plist);
 	}
 	gda_value_free (value);
+	
 	return table_id;
 }
 
@@ -2824,9 +2750,11 @@
 	const gchar *access;
 	gint table_id;
 	GValue *value;
+	SymbolDBEnginePriv *priv;
 
-	g_return_val_if_fail (tag_entry != NULL, -1);
-
+	priv = dbe->priv;
+	
+	/* we assume that tag_entry is != NULL */	
 	if ((access = tagsField (tag_entry, "access")) == NULL)
 	{
 		/* no access associated with current tag */
@@ -2836,71 +2764,63 @@
 	value = gda_value_new (G_TYPE_STRING);
 	g_value_set_string (value, access);
 
-	if ((table_id = sdb_engine_get_table_id_by_unique_name (dbe,
+	if ((table_id = sdb_engine_get_tuple_id_by_unique_name (dbe,
 									PREP_QUERY_GET_SYM_ACCESS_BY_UNIQUE_NAME,
 									"accesskind",
 									value)) < 0)
 	{
-		const GdaQuery *query;
-		GdaObject *query_result;
-		GdaParameterList *par_list;
-		GdaParameter *param;
-		GValue *value;
+		GdaSet *plist;
+		const GdaStatement *stmt;
+		GdaHolder *param;
+		GdaSet *last_inserted;
 
 		/* not found. Go on with inserting  */
-		if ((query =
+		if ((stmt =
 			 sdb_engine_get_query_by_id (dbe,
 										 PREP_QUERY_SYM_ACCESS_NEW)) == NULL)
 		{
  			g_warning ("query is null");
 			return -1;
 		}
-
-		if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-			gda_query_get_query_type ((GdaQuery *) query))
-		{
-			g_warning ("non parsed sql error");
-			return -1;
-		}
-
-		if ((par_list =
-			 gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
-		{
+		
+		if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
+		{		
 			g_warning ("par_list is NULL!\n");
 			return -1;
 		}
-
+		
 		/* accesskind parameter */
-		if ((param =
-			 gda_parameter_list_find_param (par_list, "accesskind")) == NULL)
-		{
+		if ((param = gda_set_get_holder (plist, "accesskind")) == NULL)
+		{			
 			g_warning ("param accesskind is NULL from pquery!");
+			g_object_unref (plist);
 			return -1;
 		}
-
-		value = gda_value_new (G_TYPE_STRING);
-		g_value_set_string (value, access);
-		gda_parameter_set_value (param, value);
-		gda_value_free (value);
-
-		/* execute the query with parametes just set */
-		query_result =
-			gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
+		gda_holder_set_value_str (param, NULL, access);
 		
-		if (query_result != NULL)
-		{
-			table_id = sdb_engine_get_last_insert_id (dbe);
-			g_object_unref (query_result);
-		}
+		/* execute the query with parametes just set */
+		GError *err = NULL;
+		if (gda_connection_statement_execute_non_select (priv->db_connection, 
+														 (GdaStatement*)stmt, 
+														 plist, &last_inserted,
+														 &err) == -1)
+		{		
+			table_id = -1;		
+		}			
 		else
 		{
-			table_id = -1;
+			const GValue *value = gda_set_get_holder_value (last_inserted, "+0");
+			table_id = g_value_get_int (value);
 		}
+		
+		g_object_unref (plist);
 	}
 	gda_value_free (value);
+		
 	return table_id;
 }
 
+
 static gint
 sdb_engine_add_new_sym_implementation (SymbolDBEngine * dbe,
 									   tagEntry * tag_entry)
@@ -2913,9 +2833,11 @@
 	const gchar *implementation;
 	gint table_id;
 	GValue *value;
+	SymbolDBEnginePriv *priv;
 
-	g_return_val_if_fail (tag_entry != NULL, -1);
-
+	priv = dbe->priv;
+	
+	/* we assume that tag_entry is != NULL */	
 	if ((implementation = tagsField (tag_entry, "implementation")) == NULL)
 	{
 		/* no implementation associated with current tag */
@@ -2925,20 +2847,18 @@
 	value = gda_value_new (G_TYPE_STRING);
 	g_value_set_string (value, implementation);
 
-	if ((table_id = sdb_engine_get_table_id_by_unique_name (dbe,
+	if ((table_id = sdb_engine_get_tuple_id_by_unique_name (dbe,
 							PREP_QUERY_GET_SYM_IMPLEMENTATION_BY_UNIQUE_NAME,
 							"implekind",
 							value)) < 0)
 	{
-		const GdaQuery *query;
-		GdaObject *query_result;
-		GdaParameterList *par_list;
-		GdaParameter *param;
-		GValue *value;
+		GdaSet *plist;
+		const GdaStatement *stmt;
+		GdaHolder *param;
+		GdaSet *last_inserted;
 
 		/* not found. Go on with inserting  */
-		if ((query =
-			 sdb_engine_get_query_by_id (dbe,
+		if ((stmt = sdb_engine_get_query_by_id (dbe,
 										 PREP_QUERY_SYM_IMPLEMENTATION_NEW)) ==
 			NULL)
 		{
@@ -2946,48 +2866,40 @@
 			return -1;
 		}
 
-		if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-			gda_query_get_query_type ((GdaQuery *) query))
-		{
-			g_warning ("non parsed sql error");
-			return -1;
-		}
-
-		if ((par_list =
-			 gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
-		{
+		if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
+		{		
 			g_warning ("par_list is NULL!\n");
 			return -1;
 		}
-
+		
 		/* implekind parameter */
-		if ((param =
-			 gda_parameter_list_find_param (par_list, "implekind")) == NULL)
-		{
-			g_warning ("param implekind is NULL from pquery!");
+		if ((param = gda_set_get_holder (plist, "implekind")) == NULL)
+		{			
+			g_warning ("param accesskind is NULL from pquery!");
+			g_object_unref (plist);
 			return -1;
 		}
-
-		value = gda_value_new (G_TYPE_STRING);
-		g_value_set_string (value, implementation);
-		gda_parameter_set_value (param, value);
-		gda_value_free (value);
+		gda_holder_set_value_str (param, NULL, implementation);
 
 		/* execute the query with parametes just set */
-		query_result =
-			gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
-
-		if (query_result != NULL)
-		{
-			table_id = sdb_engine_get_last_insert_id (dbe);
-			g_object_unref (query_result);
-		}
+		GError *err = NULL;
+		if (gda_connection_statement_execute_non_select (priv->db_connection, 
+														 (GdaStatement*)stmt, 
+														 plist, &last_inserted,
+														 &err) == -1)
+		{		
+			table_id = -1;		
+		}			
 		else
 		{
-			table_id = -1;
+			const GValue *value = gda_set_get_holder_value (last_inserted, "+0");
+			table_id = g_value_get_int (value);
 		}
+		g_object_unref (plist);
 	}
 	gda_value_free (value);
+	
+	
 	return table_id;
 }
 
@@ -3002,65 +2914,62 @@
                        PRIMARY KEY (symbol_id_base, symbol_id_derived)
                        );
 */
-	const GdaQuery *query;
-	GdaObject *query_result;
-	GdaParameterList *par_list;
-	GdaParameter *param;
+	GdaSet *plist;
+	const GdaStatement *stmt;
+	GdaHolder *param;
 	GValue *value;
+	SymbolDBEnginePriv *priv;
 
 	g_return_if_fail (base_symbol_id > 0);
 	g_return_if_fail (derived_symbol_id > 0);
 
-	if ((query = sdb_engine_get_query_by_id (dbe, PREP_QUERY_HERITAGE_NEW))
+	priv = dbe->priv;
+	
+	if ((stmt = sdb_engine_get_query_by_id (dbe, PREP_QUERY_HERITAGE_NEW))
 		== NULL)
 	{
 		g_warning ("query is null");
 		return;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query))
-	{
-		g_warning ("non parsed sql error");
-		return;
-	}
-
-	if ((par_list = gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
-	{
+	if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
+	{		
 		g_warning ("par_list is NULL!\n");
 		return;
 	}
-
+		
 	/* symbase parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "symbase")) == NULL)
-	{
-		g_warning ("param symbase is NULL from pquery!");
+	if ((param = gda_set_get_holder (plist, "symbase")) == NULL)
+	{			
+		g_warning ("param accesskind is NULL from pquery!");
+		g_object_unref (plist);
 		return;
 	}
-
 	value = gda_value_new (G_TYPE_INT);
 	g_value_set_int (value, base_symbol_id);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 
 	/* symderived id parameter */
-	if ((param =
-		 gda_parameter_list_find_param (par_list, "symderived")) == NULL)
+	if ((param = gda_set_get_holder (plist, "symderived")) == NULL)
 	{
 		g_warning ("param symderived is NULL from pquery!");
+		g_object_unref (plist);
 		return;
 	}
-
 	gda_value_reset_with_type (value, G_TYPE_INT);
 	g_value_set_int (value, derived_symbol_id);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 	gda_value_free (value);
 
 	/* execute the query with parametes just set */
-	query_result = 
-		gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
-	
-	if (query_result != NULL)
-		g_object_unref (query_result);
+	if (gda_connection_statement_execute_non_select (priv->db_connection, 
+													 (GdaStatement*)stmt, 
+													 plist, NULL,
+													 NULL) == -1)
+	{		
+		g_warning ("Error adding heritage");
+	}	
+	g_object_unref (plist);
 }
 
 
@@ -3077,15 +2986,17 @@
 */
 	const gchar *scope;
 	gint table_id;
-	const GdaQuery *query;
-	GdaObject *query_result;
-	GdaParameterList *par_list;
-	GdaParameter *param;
+	GdaSet *plist;
+	const GdaStatement *stmt;
+	GdaHolder *param;
+	GdaSet *last_inserted;
 	GValue *value;
+	SymbolDBEnginePriv *priv;
 
-	g_return_val_if_fail (tag_entry != NULL, -1);
 	g_return_val_if_fail (tag_entry->kind != NULL, -1);
 
+	priv = dbe->priv;
+	
 	/* This symbol will define a scope which name is tag_entry->name
 	 * For example if we get a tag MyFoo with kind "namespace", it will define 
 	 * the "MyFoo" scope, which type is "namespace MyFoo"
@@ -3099,54 +3010,45 @@
 		return -1;
 	}
 
-	if ((query = sdb_engine_get_query_by_id (dbe, PREP_QUERY_SCOPE_NEW))
+	if ((stmt = sdb_engine_get_query_by_id (dbe, PREP_QUERY_SCOPE_NEW))
 		== NULL)
 	{
 		g_warning ("query is null");
 		return -1;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query))
-	{
-		g_warning ("non parsed sql error");
-		return -1;
-	}
-
-	if ((par_list =
-		 gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
-	{
+	if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
+	{		
 		g_warning ("par_list is NULL!\n");
 		return -1;
 	}
-
+		
 	/* scope parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "scope")) == NULL)
-	{
+	if ((param = gda_set_get_holder (plist, "scope")) == NULL)
+	{			
 		g_warning ("param scope is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
-
-	value = gda_value_new (G_TYPE_STRING);
-	g_value_set_string (value, scope);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value_str (param, NULL, scope);
 
 	/* typeid parameter */
-	if ((param =
-		 gda_parameter_list_find_param (par_list, "typeid")) == NULL)
+	if ((param = gda_set_get_holder (plist, "typeid")) == NULL)
 	{
 		g_warning ("param typeid is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_value_reset_with_type (value, G_TYPE_INT);
+	value = gda_value_new (G_TYPE_INT);
 	g_value_set_int (value, type_table_id);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 	gda_value_free (value);
 
 	/* execute the query with parameters just set */
-	query_result = gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
-	if (query_result == NULL)  
+	if (gda_connection_statement_execute_non_select (priv->db_connection, 
+													 (GdaStatement*)stmt, 
+													 plist, &last_inserted,
+													 NULL) == -1)
 	{
 		GValue *value1, *value2;
 /*		DEBUG_PRINT ("sdb_engine_add_new_scope_definition (): BAD INSERTION "
@@ -3159,7 +3061,7 @@
 		value2 = gda_value_new (G_TYPE_INT);
 		g_value_set_int (value2, type_table_id);
 	
-		if ((table_id = sdb_engine_get_table_id_by_unique_name2 (dbe,
+		if ((table_id = sdb_engine_get_tuple_id_by_unique_name2 (dbe,
 												 PREP_QUERY_GET_SCOPE_ID,
 												 "scope", 
 												 value1,
@@ -3169,15 +3071,15 @@
 			table_id = -1;
 		}
 
-
 		gda_value_free (value1);
 		gda_value_free (value2);
 	}
 	else  {
-		table_id = sdb_engine_get_last_insert_id (dbe);
-		g_object_unref (query_result);
+		const GValue *value = gda_set_get_holder_value (last_inserted, "+0");
+		table_id = g_value_get_int (value);
 	}	
 
+	g_object_unref (plist);
 	return table_id;
 }
 
@@ -3206,21 +3108,23 @@
 							field_namespace varchar(256)
 							);
 */
-	const GdaQuery *query;
-	GdaObject *query_result;
-	GdaParameterList *par_list;
-	GdaParameter *param;
+	GdaSet *plist;
+	const GdaStatement *stmt;
+	GdaHolder *param;
+	GdaSet *last_inserted;
 	gint table_id;
+	SymbolDBEnginePriv *priv;
 	GValue *value;
 	const gchar *field_inherits, *field_struct, *field_typeref,
 		*field_enum, *field_union, *field_class, *field_namespace;
 	gboolean good_tag;
 
-	g_return_val_if_fail (tag_entry != NULL, -1);
-
+	/* we assume that tag_entry is != NULL */
 	/* init the flag */
 	good_tag = FALSE;
 
+	priv = dbe->priv;
+	
 	if ((field_inherits = tagsField (tag_entry, "inherits")) == NULL)
 	{
 		field_inherits = "";
@@ -3274,132 +3178,111 @@
 		return -1;
 
 
-	if ((query = sdb_engine_get_query_by_id (dbe, PREP_QUERY_TMP_HERITAGE_NEW))
+	if ((stmt = sdb_engine_get_query_by_id (dbe, PREP_QUERY_TMP_HERITAGE_NEW))
 		== NULL)
 	{
 		g_warning ("query is null");
 		return -1;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query))
-	{
-		g_warning ("non parsed sql error");
-		return -1;
-	}
-
-	if ((par_list = gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
-	{
+	if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
+	{		
 		g_warning ("par_list is NULL!\n");
 		return -1;
 	}
-
+		
 	/* symreferid parameter */
-	if ((param =
-		 gda_parameter_list_find_param (par_list, "symreferid")) == NULL)
+	if ((param = gda_set_get_holder (plist, "symreferid")) == NULL)
 	{
 		g_warning ("param symreferid is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
 
 	value = gda_value_new (G_TYPE_INT);
 	g_value_set_int (value, symbol_referer_id);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
+	gda_value_free (value);
 
 	/* finherits parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "finherits")) == NULL)
+	if ((param = gda_set_get_holder (plist, "finherits")) == NULL)
 	{
 		g_warning ("param finherits is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_value_reset_with_type (value, G_TYPE_STRING);
-	g_value_set_string (value, field_inherits);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value_str (param, NULL, field_inherits);
 
 	/* fstruct parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "fstruct")) == NULL)
+	if ((param = gda_set_get_holder (plist, "fstruct")) == NULL)
 	{
 		g_warning ("param fstruct is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_value_reset_with_type (value, G_TYPE_STRING);
-	g_value_set_string (value, field_struct);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value_str (param, NULL, field_struct);
 
 	/* ftyperef parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "ftyperef")) == NULL)
+	if ((param = gda_set_get_holder (plist, "ftyperef")) == NULL)
 	{
 		g_warning ("param ftyperef is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_value_reset_with_type (value, G_TYPE_STRING);
-	g_value_set_string (value, field_typeref);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value_str (param, NULL, field_typeref);
 
 	/* fenum parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "fenum")) == NULL)
+	if ((param = gda_set_get_holder (plist, "fenum")) == NULL)
 	{
 		g_warning ("param fenum is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_value_reset_with_type (value, G_TYPE_STRING);
-	g_value_set_string (value, field_enum);
-	gda_parameter_set_value (param, value);
-
+	gda_holder_set_value_str (param, NULL, field_enum);
+	
 	/* funion parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "funion")) == NULL)
+	if ((param = gda_set_get_holder (plist, "funion")) == NULL)
 	{
 		g_warning ("param funion is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_value_reset_with_type (value, G_TYPE_STRING);
-	g_value_set_string (value, field_union);
-	gda_parameter_set_value (param, value);
-
+	gda_holder_set_value_str (param, NULL, field_union);
+	
 	/* fclass parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "fclass")) == NULL)
+	if ((param = gda_set_get_holder (plist, "fclass")) == NULL)
 	{
 		g_warning ("param fclass is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_value_reset_with_type (value, G_TYPE_STRING);
-	g_value_set_string (value, field_class);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value_str (param, NULL, field_class);
 
 	/* fnamespace parameter */
-	if ((param =
-		 gda_parameter_list_find_param (par_list, "fnamespace")) == NULL)
+	if ((param = gda_set_get_holder (plist, "fnamespace")) == NULL)
 	{
 		g_warning ("param fnamespace is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_value_reset_with_type (value, G_TYPE_STRING);
-	g_value_set_string (value, field_namespace);
-	gda_parameter_set_value (param, value);
-	gda_value_free (value);
-
+	gda_holder_set_value_str (param, NULL, field_namespace);
 
 	/* execute the query with parametes just set */
-	query_result = 
-		gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
-
-	if (query_result != NULL)
+	if (gda_connection_statement_execute_non_select (priv->db_connection, 
+													 (GdaStatement*)stmt, 
+													 plist, &last_inserted,
+													 NULL) == -1)
 	{
-		table_id = sdb_engine_get_last_insert_id (dbe);
-		g_object_unref (query_result);
+		table_id = -1;
 	}
-	else
+	else 
 	{
-		table_id = -1;
+		const GValue *value = gda_set_get_holder_value (last_inserted, 
+														"+0");
+		table_id = g_value_get_int (value);
 	}
 	
+	g_object_unref (plist);
 	return table_id;
 }
 
@@ -3419,12 +3302,11 @@
 	gint tmp_str_splitted_length;
 	gchar *object_name = NULL;
 	gboolean free_token_name = FALSE;
-	const GdaQuery *query;
-	GdaParameterList *par_list;
-	GdaParameter *param;
+	GdaSet *plist;
+	const GdaStatement *stmt;
+	GdaHolder *param;
 	SymbolDBEnginePriv *priv;
 
-	g_return_val_if_fail (dbe != NULL, FALSE);
 	g_return_val_if_fail (G_VALUE_HOLDS_STRING (token_value), FALSE);
 	
 	priv = dbe->priv;
@@ -3436,9 +3318,6 @@
 		return -1;
 	}
 
-/*	DEBUG_PRINT ("sdb_engine_second_pass_update_scope_1 ()---------------------");
-	DEBUG_PRINT ("sdb_engine_second_pass_update_scope_1 (): %s", tmp_str);*/
-	
 	/* we could have something like "First::Second::Third::Fourth" as tmp_str, so 
 	 * take only the lastscope, in this case 'Fourth'.
 	 */
@@ -3466,16 +3345,13 @@
 
 	g_strfreev (tmp_str_splitted);
 
-/*	DEBUG_PRINT ("sdb_engine_second_pass_update_scope_1(): got %s %s (from %s)", 
-				 token_name, object_name, tmp_str);	*/
-	
 	value1 = gda_value_new (G_TYPE_STRING);
 	g_value_set_string (value1, token_name);
 
 	value2 = gda_value_new (G_TYPE_STRING);
 	g_value_set_string (value2, object_name);
 
-	if ((scope_id = sdb_engine_get_table_id_by_unique_name2 (dbe,
+	if ((scope_id = sdb_engine_get_tuple_id_by_unique_name2 (dbe,
 									 PREP_QUERY_GET_SYMBOL_SCOPE_DEFINITION_ID,
 									 "tokenname",
 									 value1,
@@ -3503,11 +3379,7 @@
 													  data_row);
 	symbol_referer_id = g_value_get_int (value_id2);
 	
-/*	DEBUG_PRINT ("sdb_engine_second_pass_update_scope_1 () :updating sym %d "
-				 "with %d",  
-				 symbol_referer_id, scope_id);*/
-	
-	if ((query = sdb_engine_get_query_by_id (dbe,
+	if ((stmt = sdb_engine_get_query_by_id (dbe,
 											 PREP_QUERY_UPDATE_SYMBOL_SCOPE_ID))
 		== NULL)
 	{
@@ -3515,44 +3387,43 @@
 		return -1;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL
-		== gda_query_get_query_type ((GdaQuery *) query))
-	{
-		g_warning ("non parsed sql error");
-		return -1;
-	}
-
-	if ((par_list = gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
-	{
+	if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
+	{		
 		g_warning ("par_list is NULL!\n");
 		return -1;
 	}
 
 	/* scopeid parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "scopeid")) == NULL)
+	if ((param = gda_set_get_holder (plist, "scopeid")) == NULL)
 	{
 		g_warning ("param scopeid is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
 
 	value = gda_value_new (G_TYPE_INT);
 	g_value_set_int (value, scope_id);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 
 	/* symbolid parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "symbolid")) == NULL)
+	if ((param = gda_set_get_holder (plist, "symbolid")) == NULL)
 	{
 		g_warning ("param symbolid is NULL from pquery!");
+		g_object_unref (plist);
 		return -1;
 	}
 
 	gda_value_reset_with_type (value, G_TYPE_INT);
 	g_value_set_int (value, symbol_referer_id);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 	gda_value_free (value);
 
 	/* execute the query with parametes just set */
-	gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
+	gda_connection_statement_execute_non_select (priv->db_connection, 
+													 (GdaStatement*)stmt, 
+													 plist, NULL,
+													 NULL);
+
 
 	return symbol_referer_id;
 }
@@ -3766,7 +3637,7 @@
 				g_value_set_string (value1, klass_name);
 
 				if ((base_klass_id =
-					 sdb_engine_get_table_id_by_unique_name (dbe,
+					 sdb_engine_get_tuple_id_by_unique_name (dbe,
 										 PREP_QUERY_GET_SYMBOL_ID_BY_CLASS_NAME,
 										 "klassname",
 										 value1)) < 0)
@@ -3794,7 +3665,7 @@
 
 				DEBUG_PRINT ("value1 : %s value2 : %s", klass_name, namespace_name);
 				if ((base_klass_id =
-					 sdb_engine_get_table_id_by_unique_name2 (dbe,
+					 sdb_engine_get_tuple_id_by_unique_name2 (dbe,
 						  PREP_QUERY_GET_SYMBOL_ID_BY_CLASS_NAME_AND_NAMESPACE,
 						  "klassname",
 						  value1,
@@ -3862,11 +3733,14 @@
 static void
 sdb_engine_second_pass_do (SymbolDBEngine * dbe)
 {
-	GdaObject *query_result;
-	const GdaQuery *query1, *query2, *query3;
+	const GdaStatement *stmt1, *stmt2, *stmt3;
+	GdaDataModel *data_model;
+	SymbolDBEnginePriv *priv;
 
+	priv = dbe->priv;
+	
 	/* prepare for scope second scan */
-	if ((query1 =
+	if ((stmt1 =
 		 sdb_engine_get_query_by_id (dbe,
 									 PREP_QUERY_GET_ALL_FROM_TMP_HERITAGE))
 		== NULL)
@@ -3875,33 +3749,28 @@
 		return;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query1))
-	{
-		g_warning ("non parsed sql error");
-		return;
-	}
-
 	/* execute the query */
-	query_result = gda_query_execute ((GdaQuery *) query1, NULL, FALSE, NULL);
-	
-	if (!GDA_IS_DATA_MODEL (query_result) ||
-		gda_data_model_get_n_rows (GDA_DATA_MODEL (query_result)) <= 0)
-	{
-		if (query_result != NULL)
-			g_object_unref (query_result);
-		query_result = NULL;
+	data_model = gda_connection_statement_execute_select (priv->db_connection, 
+														  (GdaStatement*)stmt1, 
+														  NULL, NULL);
+	
+	if (!GDA_IS_DATA_MODEL (data_model) ||
+		gda_data_model_get_n_rows (GDA_DATA_MODEL (data_model)) <= 0)
+	{
+		if (data_model != NULL)
+			g_object_unref (data_model);
+		data_model = NULL;
 	}
 	else
 	{
-		sdb_engine_second_pass_update_scope (dbe, GDA_DATA_MODEL (query_result));
+		sdb_engine_second_pass_update_scope (dbe, data_model);
 	}
 
-	if (query_result != NULL)
-		g_object_unref (query_result);
+	if (data_model != NULL)
+		g_object_unref (data_model);
 
 	/* prepare for heritage second scan */
-	if ((query2 =
+	if ((stmt2 =
 		 sdb_engine_get_query_by_id (dbe,
 						 PREP_QUERY_GET_ALL_FROM_TMP_HERITAGE_WITH_INHERITS))
 		== NULL)
@@ -3910,33 +3779,28 @@
 		return;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query2))
-	{
-		g_warning ("non parsed sql error");
-		return;
-	}
-
 	/* execute the query */
-	query_result = gda_query_execute ((GdaQuery *) query2, NULL, FALSE, NULL);
-
-	if (!GDA_IS_DATA_MODEL (query_result) ||
-		gda_data_model_get_n_rows (GDA_DATA_MODEL (query_result)) <= 0)
-	{
-		if (query_result != NULL)
-			g_object_unref (query_result);
-		query_result = NULL;
+	data_model = gda_connection_statement_execute_select (priv->db_connection, 
+														  (GdaStatement*)stmt2, 
+														  NULL, NULL);
+
+	if (!GDA_IS_DATA_MODEL (data_model) ||
+		gda_data_model_get_n_rows (GDA_DATA_MODEL (data_model)) <= 0)
+	{
+		if (data_model != NULL)
+			g_object_unref (data_model);
+		data_model = NULL;
 	}
 	else
 	{
-		sdb_engine_second_pass_update_heritage (dbe, GDA_DATA_MODEL (query_result));
+		sdb_engine_second_pass_update_heritage (dbe, data_model);
 	}
 
-	if (query_result != NULL)
-		g_object_unref (query_result);
+	if (data_model != NULL)
+		g_object_unref (data_model);
 
 	/* clean tmp heritage table */
-	if ((query3 =
+	if ((stmt3 =
 		 sdb_engine_get_query_by_id (dbe,
 									 PREP_QUERY_TMP_HERITAGE_DELETE_ALL))
 		== NULL)
@@ -3945,19 +3809,10 @@
 		return;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query3))
-	{
-		g_warning ("non parsed sql error");
-		return;
-	}
-
 	/* execute the query */
-	query_result =
-		gda_query_execute ((GdaQuery *) query3, NULL, FALSE, NULL);
-	
-	if (query_result != NULL)
-		g_object_unref (query_result);
+	gda_connection_statement_execute_non_select (priv->db_connection, 
+														  (GdaStatement*)stmt3, 
+														  NULL, NULL, NULL);	
 }
 
 /* base_prj_path can be NULL. In that case path info tag_entry will be taken
@@ -3988,10 +3843,10 @@
                      );
 */
 	SymbolDBEnginePriv *priv;
-	const GdaQuery *query;
-	GdaObject *query_result;
-	GdaParameterList *par_list;
-	GdaParameter *param;
+	GdaSet *plist;
+	const GdaStatement *stmt;
+	GdaHolder *param;
+	GdaSet *last_inserted;
 	const gchar *tmp_str;
 	gint table_id, symbol_id;
 	gint file_defined_id = 0;
@@ -4039,7 +3894,7 @@
 			g_value_set_string (value, fake_file);
 	}
 
-	if ((file_defined_id = sdb_engine_get_table_id_by_unique_name (dbe,
+	if ((file_defined_id = sdb_engine_get_tuple_id_by_unique_name (dbe,
 									   PREP_QUERY_GET_FILE_ID_BY_UNIQUE_NAME,
 									   "filepath",
 									   value)) < 0)
@@ -4128,7 +3983,7 @@
 	value3 = gda_value_new (G_TYPE_INT);
 	g_value_set_int (value3, type_id);
 
-	if ((symbol_id = sdb_engine_get_table_id_by_unique_name3 (dbe,
+	if ((symbol_id = sdb_engine_get_tuple_id_by_unique_name3 (dbe,
 								  PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY,
 								  "symname", value1,
 								  "filedefid",value2,
@@ -4142,66 +3997,53 @@
 		gda_value_free (value3);
 
 		/* create specific query for a fresh new symbol */
-		if ((query = sdb_engine_get_query_by_id (dbe, PREP_QUERY_SYMBOL_NEW))
+		if ((stmt = sdb_engine_get_query_by_id (dbe, PREP_QUERY_SYMBOL_NEW))
 			== NULL)
 		{
 			g_warning ("query is null");
 			return -1;
 		}
 
-		if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-			gda_query_get_query_type ((GdaQuery *) query))
-		{
-			g_warning ("non parsed sql error");
-			gda_value_free (value);
-			return -1;
-		}
-
-		if ((par_list =
-			 gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
-		{
+		if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
+		{		
 			g_warning ("par_list is NULL!\n");
 			gda_value_free (value);
 			return -1;
 		}
-
+		
 		/* filedefid parameter */
-		if ((param =
-			 gda_parameter_list_find_param (par_list, "filedefid")) == NULL)
+		if ((param = gda_set_get_holder (plist, "filedefid")) == NULL)
 		{
 			g_warning ("param filedefid is NULL from pquery!");
 			gda_value_free (value);
+			g_object_unref (plist);
 			return -1;
 		}
-
 		gda_value_reset_with_type (value, G_TYPE_INT);
 		g_value_set_int (value, file_defined_id);
-		gda_parameter_set_value (param, value);
+		gda_holder_set_value (param, value);
 
 		/* name parameter */
-		if ((param = gda_parameter_list_find_param (par_list, "name")) == NULL)
+		if ((param = gda_set_get_holder (plist, "name")) == NULL)
 		{
 			g_warning ("param name is NULL from pquery!");
 			gda_value_free (value);
+			g_object_unref (plist);
 			return -1;
 		}
-
-		gda_value_reset_with_type (value, G_TYPE_STRING);
-		g_value_set_string (value, name);
-		gda_parameter_set_value (param, value);
+		gda_holder_set_value_str (param, NULL, name);
 
 		/* typeid parameter */
-		if ((param =
-			 gda_parameter_list_find_param (par_list, "typeid")) == NULL)
+		if ((param = gda_set_get_holder (plist, "typeid")) == NULL)
 		{
 			g_warning ("param typeid is NULL from pquery!");
 			gda_value_free (value);
-			return -1;
+			g_object_unref (plist);
+			return -1;			
 		}
-
 		gda_value_reset_with_type (value, G_TYPE_INT);
 		g_value_set_int (value, type_id);
-		gda_parameter_set_value (param, value);
+		gda_holder_set_value (param, value);
 	}
 	else
 	{
@@ -4213,7 +4055,7 @@
 		gda_value_free (value3);
 
 		/* create specific query for a fresh new symbol */
-		if ((query = sdb_engine_get_query_by_id (dbe,
+		if ((stmt = sdb_engine_get_query_by_id (dbe,
 												 PREP_QUERY_UPDATE_SYMBOL_ALL))
 			== NULL)
 		{
@@ -4221,16 +4063,7 @@
 			return -1;
 		}
 
-		if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-			gda_query_get_query_type ((GdaQuery *) query))
-		{
-			g_warning ("non parsed sql error");
-			gda_value_free (value);
-			return -1;
-		}
-
-		if ((par_list =
-			 gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
+		if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
 		{
 			g_warning ("par_list is NULL!\n");
 			gda_value_free (value);
@@ -4238,148 +4071,142 @@
 		}
 
 		/* symbolid parameter */
-		if ((param = gda_parameter_list_find_param (par_list, "symbolid"))
-			== NULL)
+		if ((param = gda_set_get_holder (plist, "symbolid")) == NULL)
 		{
 			g_warning ("param isfilescope is NULL from pquery!");
 			gda_value_free (value);
+			g_object_unref (plist);
 			return -1;
 		}
 
 		gda_value_reset_with_type (value, G_TYPE_INT);
 		g_value_set_int (value, symbol_id);
-		gda_parameter_set_value (param, value);
+		gda_holder_set_value (param, value);
 	}
 
 	/* common params */
 
 	/* fileposition parameter */
-	if ((param =
-		 gda_parameter_list_find_param (par_list, "fileposition")) == NULL)
+	if ((param = gda_set_get_holder (plist, "fileposition")) == NULL)
 	{
 		g_warning ("param fileposition is NULL from pquery!");
 		gda_value_free (value);
+		g_object_unref (plist);
 		return -1;
 	}
-
 	gda_value_reset_with_type (value, G_TYPE_INT);
 	g_value_set_int (value, file_position);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 
 	
 	/* isfilescope parameter */
-	if ((param =
-		 gda_parameter_list_find_param (par_list, "isfilescope")) == NULL)
+	if ((param = gda_set_get_holder (plist, "isfilescope")) == NULL)	
 	{
 		g_warning ("param isfilescope is NULL from pquery!");
 		gda_value_free (value);
+		g_object_unref (plist);
 		return -1;
 	}
-
 	gda_value_reset_with_type (value, G_TYPE_INT);
 	g_value_set_int (value, is_file_scope);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 
 	/* signature parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "signature")) == NULL)
+	if ((param = gda_set_get_holder (plist, "signature")) == NULL)	
 	{
 		g_warning ("param signature is NULL from pquery!");
 		gda_value_free (value);
+		g_object_unref (plist);
 		return -1;
 	}
-
-	gda_value_reset_with_type (value, G_TYPE_STRING);
-	g_value_set_string (value, signature);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value_str (param, NULL, signature);
 
 	/* scopedefinitionid parameter */
-	if ((param =
-		 gda_parameter_list_find_param (par_list, "scopedefinitionid")) == NULL)
+	if ((param = gda_set_get_holder (plist, "scopedefinitionid")) == NULL)	
 	{
 		g_warning ("param scopedefinitionid is NULL from pquery!");
 		gda_value_free (value);
+		g_object_unref (plist);
 		return -1;
 	}
-
 	gda_value_reset_with_type (value, G_TYPE_INT);
 	g_value_set_int (value, scope_definition_id);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 
 	/* scopeid parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "scopeid")) == NULL)
+	if ((param = gda_set_get_holder (plist, "scopeid")) == NULL)	
 	{
 		g_warning ("param scopeid is NULL from pquery!");
 		gda_value_free (value);
+		g_object_unref (plist);
 		return -1;
 	}
-
 	gda_value_reset_with_type (value, G_TYPE_INT);
 	g_value_set_int (value, scope_id);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 
 	/* kindid parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "kindid")) == NULL)
+	if ((param = gda_set_get_holder (plist, "kindid")) == NULL)	
 	{
 		g_warning ("param kindid is NULL from pquery!");
 		gda_value_free (value);
+		g_object_unref (plist);
 		return -1;
 	}
-
 	gda_value_reset_with_type (value, G_TYPE_INT);
 	g_value_set_int (value, kind_id);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 
 	/* accesskindid parameter */
-	if ((param =
-		 gda_parameter_list_find_param (par_list, "accesskindid")) == NULL)
+	if ((param = gda_set_get_holder (plist, "accesskindid")) == NULL)	
 	{
 		g_warning ("param accesskindid is NULL from pquery!");
 		gda_value_free (value);
+		g_object_unref (plist);
 		return -1;
 	}
-
 	gda_value_reset_with_type (value, G_TYPE_INT);
 	g_value_set_int (value, access_kind_id);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 
 	/* implementationkindid parameter */
-	if ((param =
-		 gda_parameter_list_find_param (par_list,
-										"implementationkindid")) == NULL)
+	if ((param = gda_set_get_holder (plist, "implementationkindid")) == NULL)	
 	{
 		g_warning ("param implementationkindid is NULL from pquery!");
 		gda_value_free (value);
+		g_object_unref (plist);
 		return -1;
 	}
-
 	gda_value_reset_with_type (value, G_TYPE_INT);
 	g_value_set_int (value, implementation_kind_id);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 
 	/* updateflag parameter */
-	if ((param =
-		 gda_parameter_list_find_param (par_list, "updateflag")) == NULL)
+	if ((param = gda_set_get_holder (plist, "updateflag")) == NULL)
 	{
 		g_warning ("param updateflag is NULL from pquery!");
 		gda_value_free (value);
+		g_object_unref (plist);
 		return -1;
 	}
-
 	gda_value_reset_with_type (value, G_TYPE_INT);
 	g_value_set_int (value, update_flag);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 	gda_value_free (value);
 
 	/* execute the query with parametes just set */
-	query_result = 
-		gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
+	gint nrows;
+	nrows = gda_connection_statement_execute_non_select (priv->db_connection, 
+													 (GdaStatement*)stmt, 
+													 plist, &last_inserted,
+													 NULL);
 	
 	if (sym_was_updated == FALSE)
 	{
-		if (query_result != NULL)
+		if (nrows > 0)
 		{
-			table_id = sdb_engine_get_last_insert_id (dbe);
-			g_object_unref (query_result);
+			const GValue *value = gda_set_get_holder_value (last_inserted, "+0");
+			table_id = g_value_get_int (value);			
 		
 			/* This is a wrong place to emit the symbol-updated signal. Infact
 		 	 * db is in a inconsistent state, e.g. inheritance references are still
@@ -4395,11 +4222,10 @@
 	}
 	else
 	{
-		if (query_result != NULL)
+		if (nrows > 0)
 		{
 			table_id = symbol_id;
-			g_object_unref (query_result);
-			
+						
 			/* This is a wrong place to emit the symbol-updated signal. Infact
 		  	 * db is in a inconsistent state, e.g. inheritance references are still
 		  	 * *not* calculated.
@@ -4418,6 +4244,9 @@
 	 */
 	if (table_id > 0)
 		sdb_engine_add_new_tmp_heritage_scope (dbe, tag_entry, table_id);
+	
+	g_object_unref (plist);
+	
 	return table_id;
 }
 
@@ -4428,19 +4257,17 @@
 static void
 sdb_engine_detects_removed_ids (SymbolDBEngine *dbe)
 {
-	const GdaQuery *query, *query2;
-	GdaObject *query_result;
+	const GdaStatement *stmt1, *stmt2;
+	GdaDataModel *data_model;
 	SymbolDBEnginePriv *priv;
-	gint num_rows;
-	gint i;
-	g_return_if_fail (dbe != NULL);
-	
+	gint i, num_rows;	
+		
 	priv = dbe->priv;
 	
 	/* ok, now we should read from __tmp_removed all the symbol ids which have
 	 * been removed, and emit a signal 
 	 */
-	if ((query = sdb_engine_get_query_by_id (dbe,
+	if ((stmt1 = sdb_engine_get_query_by_id (dbe,
 											 PREP_QUERY_GET_REMOVED_IDS))
 		== NULL)
 	{
@@ -4448,29 +4275,25 @@
 		return;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query))
-	{
-		g_warning ("non parsed sql error");
-		return;
-	}
 	
-	query_result = gda_query_execute ((GdaQuery *) query, NULL, FALSE,
-									 NULL);
+	data_model = gda_connection_statement_execute_select (priv->db_connection, 
+												   (GdaStatement*)stmt1, 
+													NULL, NULL);
+
 	
-	if (GDA_IS_DATA_MODEL (query_result)) 
+	if (GDA_IS_DATA_MODEL (data_model)) 
 	{
-		if ((num_rows = gda_data_model_get_n_rows (GDA_DATA_MODEL (query_result))) <= 0)
+		if ((num_rows = gda_data_model_get_n_rows (data_model)) <= 0)
 		{
 			DEBUG_PRINT ("sdb_engine_detects_removed_ids (): nothing to remove");
-			g_object_unref (query_result);
+			g_object_unref (data_model);
 			return;
 		}
 	}
 	else
 	{
-		if (query_result != NULL)
-			g_object_unref (query_result);
+		if (data_model != NULL)
+			g_object_unref (data_model);
 		return;
 	}
 
@@ -4479,7 +4302,7 @@
 	{
 		const GValue *val;
 		gint tmp;
-		val = gda_data_model_get_value_at (GDA_DATA_MODEL (query_result), 0, i);
+		val = gda_data_model_get_value_at (data_model, 0, i);
 		tmp = g_value_get_int (val);
 	
 		DEBUG_PRINT ("EMITTING symbol-removed");
@@ -4487,10 +4310,10 @@
 		g_async_queue_push (priv->signals_queue, (gpointer)tmp);
 	}
 
-	g_object_unref (query_result);
+	g_object_unref (data_model);
 	
 	/* let's clean the tmp_table */
-	if ((query2 = sdb_engine_get_query_by_id (dbe,
+	if ((stmt2 = sdb_engine_get_query_by_id (dbe,
 											 PREP_QUERY_TMP_REMOVED_DELETE_ALL))
 		== NULL)
 	{
@@ -4498,21 +4321,11 @@
 		return;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query2))
-	{
-		g_warning ("non parsed sql error");
-		return;
-	}
-	
 	/* bye bye */
-	query_result =
-		gda_query_execute ((GdaQuery *) query2, NULL, FALSE, NULL);
-	
-	if (query_result)
-	{
-		g_object_unref (query_result);
-	}
+	gda_connection_statement_execute_non_select (priv->db_connection, 
+													 (GdaStatement*)stmt2, 
+													 NULL, NULL,
+													 NULL);
 }
 
 /**
@@ -4524,24 +4337,13 @@
 static gboolean
 sdb_engine_update_file (SymbolDBEngine * dbe, const gchar * file_on_db)
 {
-	const GdaQuery *query;
-	GdaObject *query_result;
-	gchar *query_str;
-	GdaParameterList *par_list;
-	GdaParameter *param;
-	GValue *value;
+	GdaSet *plist;
+	const GdaStatement *stmt1, *stmt2, *stmt3;
+	GdaHolder *param;
 	SymbolDBEnginePriv *priv;
 
-	g_return_val_if_fail (dbe != NULL, FALSE);
-	
 	priv = dbe->priv;
 
-	if (symbol_db_engine_is_project_opened (dbe, priv->project_name) == FALSE) 
-	{
-		g_warning ("project is not opened");
-		return FALSE;
-	}
-	
 	/* if we're updating symbols we must do some other operations on db 
 	 * symbols, like remove the ones which don't have an update_flag = 1 
 	 * per updated file.
@@ -4551,35 +4353,69 @@
 	 * update_flag = 0. 
 	 */
 
-	/* FIXME: libgda 3.0 doesn't have support for JOIN keyword at all on
-	 * prepared statements.
-	 * Said this we cannot expect to run queries on a really performant
-	 * way. 
-	 */
-
 	/* Triggers will take care of updating/deleting connected symbols
 	 * tuples, like sym_kind, sym_type etc */
-	query_str = g_strdup_printf ("DELETE FROM symbol WHERE "
-								 "file_defined_id = (SELECT file_id FROM file "
-								 "WHERE file_path = \"%s\") AND update_flag = 0",
-								 file_on_db);
+	if ((stmt1 = sdb_engine_get_query_by_id (dbe, 
+									PREP_QUERY_REMOVE_NON_UPDATED_SYMBOLS)) == NULL)
+	{
+		g_warning ("query is null");
+		return FALSE;
+	}
 
-	sdb_engine_execute_non_select_sql (dbe, query_str);
-	g_free (query_str);
+	if (gda_statement_get_parameters ((GdaStatement*)stmt1, &plist, NULL) == FALSE)
+	{
+		g_warning ("par_list is NULL!\n");
+		return FALSE;
+	}
+	
+	if ((param = gda_set_get_holder (plist, "filepath")) == NULL)
+	{
+		g_warning ("param filepath is NULL from pquery!");
+		g_object_unref (plist);
+		return FALSE;
+	}
+	gda_holder_set_value_str (param, NULL, file_on_db);
+	
+	gda_connection_statement_execute_non_select (priv->db_connection, (GdaStatement*)stmt1, 
+														 plist, NULL, NULL);	
 
 	/* emits removed symbols signals */
 	sdb_engine_detects_removed_ids (dbe);
+
+	/* stay ready for the next statement */
+	g_object_unref (plist);
+	
+	/* reset the update_flag to 0 */	
+	if ((stmt2 = sdb_engine_get_query_by_id (dbe, 
+									PREP_QUERY_RESET_UPDATE_FLAG_SYMBOLS)) == NULL)
+	{
+		g_warning ("query is null");
+		return FALSE;
+	}
+	
+	if (gda_statement_get_parameters ((GdaStatement*)stmt2, &plist, NULL) == FALSE)
+	{
+		g_warning ("par_list is NULL!\n");
+		return FALSE;
+	}
 	
-	/* reset the update_flag to 0 */
-	query_str = g_strdup_printf ("UPDATE symbol SET update_flag = 0 "
-								 "WHERE file_defined_id = (SELECT file_id FROM file WHERE "
-								 "file_path = \"%s\")", file_on_db);
+	if ((param = gda_set_get_holder (plist, "filepath")) == NULL)
+	{
+		g_warning ("param filepath is NULL from pquery!");
+		g_object_unref (plist);
+		return FALSE;
+	}
+	gda_holder_set_value_str (param, NULL, file_on_db);
 
-	sdb_engine_execute_non_select_sql (dbe, query_str);
-	g_free (query_str);
+	
+	gda_connection_statement_execute_non_select (priv->db_connection, (GdaStatement*)stmt2, 
+														 plist, NULL, NULL);	
 
+	/* ready for the last one */
+	g_object_unref (plist);
+	
 	/* last but not least, update the file analyse_time */
-	if ((query = sdb_engine_get_query_by_id (dbe,
+	if ((stmt3 = sdb_engine_get_query_by_id (dbe,
 											 PREP_QUERY_UPDATE_FILE_ANALYSE_TIME))
 		== NULL)
 	{
@@ -4587,37 +4423,25 @@
 		return FALSE;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query))
-	{
-		g_warning ("non parsed sql error");
-		return FALSE;
-	}
-
-	if ((par_list = gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
+	if (gda_statement_get_parameters ((GdaStatement*)stmt2, &plist, NULL) == FALSE)
 	{
 		g_warning ("par_list is NULL!\n");
 		return FALSE;
 	}
-
+	
 	/* filepath parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "filepath")) == NULL)
+	if ((param = gda_set_get_holder (plist, "filepath")) == NULL)
 	{
 		g_warning ("param filepath is NULL from pquery!");
+		g_object_unref (plist);
 		return FALSE;
 	}
+	gda_holder_set_value_str (param, NULL, file_on_db);
 
-	value = gda_value_new (G_TYPE_STRING);
-	g_value_set_string (value, file_on_db);
-	gda_parameter_set_value (param, value);
-
-	gda_value_free (value);
-	query_result = 
-		gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
+	gda_connection_statement_execute_non_select (priv->db_connection, (GdaStatement*)stmt3, 
+														 plist, NULL, NULL);
 	
-	if (query_result)
-		g_object_unref (query_result);
-
+	g_object_unref (plist);
 	return TRUE;
 }
 
@@ -4645,12 +4469,20 @@
 	{
 		gchar *node = (gchar *) g_ptr_array_index (files_to_scan, i);
 		
+		if (strstr (node, priv->project_directory) == NULL) 
+		{
+			g_warning ("on_scan_update_files_symbols_end  node %s is shorter than "
+					   "prj_directory %s",
+					   node, priv->project_directory);
+			continue;
+		}
+		
 		/* clean the db from old un-updated with the last update step () */
 		if (sdb_engine_update_file (dbe, node + 
-									strlen (priv->data_source)) == FALSE)
+									strlen (priv->project_directory)) == FALSE)
 		{
 			g_warning ("Error processing file %s", node + 
-					   strlen (priv->data_source) );
+					   strlen (priv->project_directory) );
 			return;
 		}
 		g_free (node);
@@ -4665,14 +4497,12 @@
 	 */
 	if (update_data->update_prj_analyse_time == TRUE)
 	{
-		const GdaQuery *query;
-		GdaObject *query_result;
-		GdaParameterList *par_list;
-		GdaParameter *param;
-		GValue *value;
+		GdaSet *plist;
+		const GdaStatement *stmt;
+		GdaHolder *param;
 
 		/* and the project analyse_time */
-		if ((query = sdb_engine_get_query_by_id (dbe,
+		if ((stmt = sdb_engine_get_query_by_id (dbe,
 									PREP_QUERY_UPDATE_PROJECT_ANALYSE_TIME))
 			== NULL)
 		{
@@ -4680,45 +4510,31 @@
 			return;
 		}
 
-		if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-			gda_query_get_query_type ((GdaQuery *) query))
-		{
-			g_warning ("non parsed sql error");
-			return;
-		}
-
-		if ((par_list =
-			 gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
+		if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
 		{
 			g_warning ("par_list is NULL!\n");
 			return;
 		}
-
+	
 		/* prjname parameter */
-		if ((param = gda_parameter_list_find_param (par_list, "prjname"))
-			== NULL)
+		if ((param = gda_set_get_holder (plist, "prjname")) == NULL)
 		{
 			g_warning ("param prjname is NULL from pquery!");
+			g_object_unref (plist);
 			return;
 		}
-
-		value = gda_value_new (G_TYPE_STRING);
-		g_value_set_string (value, priv->project_name);
-		gda_parameter_set_value (param, value);
-
-		gda_value_free (value);
-
-		DEBUG_PRINT ("updating project analyse_time");
-		query_result = 
-			gda_query_execute ((GdaQuery *) query, par_list, FALSE, NULL);
-		
-		if (query_result)
-			g_object_unref (query_result);
+		gda_holder_set_value_str (param, NULL, update_data->project);
+	
+		gda_connection_statement_execute_non_select (priv->db_connection, 
+													 (GdaStatement*)stmt, 
+													 plist, NULL, NULL);
+		g_object_unref (plist);
 	}	
 	
 	/* free the GPtrArray. */
 	g_ptr_array_free (files_to_scan, TRUE);
 
+	g_free (update_data->project);
 	g_free (update_data);
 }
 
@@ -4733,6 +4549,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. 
@@ -4752,17 +4686,12 @@
 	DEBUG_PRINT ("symbol_db_engine_update_files_symbols ()");
 	g_return_val_if_fail (priv->db_connection != NULL, FALSE);
 	g_return_val_if_fail (project != NULL, FALSE);
-	
-	if (symbol_db_engine_is_project_opened (dbe, project) == FALSE) 
-	{
-		g_warning ("project is not opened");
-		return FALSE;
-	}
-	
+
 	update_data = g_new0 (UpdateFileSymbolsData, 1);
 	
 	update_data->update_prj_analyse_time = update_prj_analyse_time;
 	update_data->files_path = files_path;
+	update_data->project = g_strdup (project);
 	
 	/* data will be freed when callback will be called. The signal will be
 	 * disconnected too, don't worry about disconneting it by hand.
@@ -4783,32 +4712,26 @@
 gboolean
 symbol_db_engine_update_project_symbols (SymbolDBEngine *dbe, const gchar *project)
 {
-	const GdaQuery *query;
-	GdaParameterList *par_list;
-	GdaParameter *param;
+	GdaSet *plist;
+	const GdaStatement *stmt;
+	GdaHolder *param;
 	GValue *value;
-	GdaObject *query_result;
+	GdaDataModel *data_model;
 	gint project_id;
 	gint num_rows = 0;
 	gint i;
 	GPtrArray *files_to_scan;
 	SymbolDBEnginePriv *priv;
-
 	
 	g_return_val_if_fail (dbe != NULL, FALSE);
-	if (symbol_db_engine_is_project_opened (dbe, project) == FALSE) 
-	{
-		g_warning ("project is not opened");
-		return FALSE;
-	}
-	
+	g_return_val_if_fail (project != NULL, FALSE);
 	priv = dbe->priv;
 
 	value = gda_value_new (G_TYPE_STRING);
 	g_value_set_string (value, project);
 
 	/* get project id */
-	if ((project_id = sdb_engine_get_table_id_by_unique_name (dbe,
+	if ((project_id = sdb_engine_get_tuple_id_by_unique_name (dbe,
 									 PREP_QUERY_GET_PROJECT_ID_BY_UNIQUE_NAME,
 									 "prjname",
 									 value)) <= 0)
@@ -4817,7 +4740,7 @@
 		return FALSE;
 	}
 
-	if ((query = sdb_engine_get_query_by_id (dbe,
+	if ((stmt = sdb_engine_get_query_by_id (dbe,
 								 PREP_QUERY_GET_ALL_FROM_FILE_BY_PROJECT_ID))
 		== NULL)
 	{
@@ -4826,43 +4749,34 @@
 		return FALSE;
 	}
 
-	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
-		gda_query_get_query_type ((GdaQuery *) query))
-	{
-		g_warning ("non parsed sql error");
-		gda_value_free (value);
-		return FALSE;
-	}
-
-	if ((par_list = gda_query_get_parameter_list ((GdaQuery *) query)) == NULL)
+	if (gda_statement_get_parameters ((GdaStatement*)stmt, &plist, NULL) == FALSE)
 	{
 		g_warning ("par_list is NULL!\n");
-		gda_value_free (value);
 		return FALSE;
 	}
 
 	/* prjid parameter */
-	if ((param = gda_parameter_list_find_param (par_list, "prjid")) == NULL)
+	if ((param = gda_set_get_holder (plist, "prjid")) == NULL)
 	{
-		g_warning ("param prjname is NULL from pquery!");
+		g_warning ("param prjid is NULL from pquery!");
+		g_object_unref (plist);
 		return FALSE;
 	}
-
 	gda_value_reset_with_type (value, G_TYPE_INT);
 	g_value_set_int (value, project_id);
-	gda_parameter_set_value (param, value);
+	gda_holder_set_value (param, value);
 
 	/* execute the query with parametes just set */
-	query_result =	gda_query_execute
-				  ((GdaQuery *) query, par_list, FALSE, NULL);
+	data_model = gda_connection_statement_execute_select (priv->db_connection, 
+												   (GdaStatement*)stmt, NULL, NULL);
 
-	if (!GDA_IS_DATA_MODEL (query_result) ||
-		(num_rows = gda_data_model_get_n_rows (GDA_DATA_MODEL (query_result))) <= 0)
+	if (!GDA_IS_DATA_MODEL (data_model) ||
+		(num_rows = gda_data_model_get_n_rows (GDA_DATA_MODEL (data_model))) <= 0)
 	{
 		g_message ("no rows");
-		if (query_result != NULL)
-			g_object_unref (query_result);
-		query_result = NULL;
+		if (data_model != NULL)
+			g_object_unref (data_model);
+		data_model = NULL;
 	}
 
 	/* we don't need it anymore */
@@ -4884,7 +4798,7 @@
 		GnomeVFSHandle *handle;
 
 		if ((value =
-			 gda_data_model_get_value_at_col_name (GDA_DATA_MODEL (query_result),
+			 gda_data_model_get_value_at_col_name (data_model,
 												   "file_path", i)) == NULL)
 		{
 			continue;
@@ -4892,15 +4806,17 @@
 
 		/* build abs path. */
 		file_name = g_value_get_string (value);
-		if (priv->data_source != NULL)
+		if (priv->db_directory != NULL)
 		{
-			abs_vfs_path = g_strdup_printf ("file://%s%s", priv->data_source,
+			/* FIXME */
+			abs_vfs_path = g_strdup_printf ("file://%s%s", priv->project_directory,
 										file_name);
-			file_abs_path = g_strdup_printf ("%s%s", priv->data_source,
+			file_abs_path = g_strdup_printf ("%s%s", priv->project_directory,
 										file_name);
 		}
 		else
 		{
+			/* FIXME */
 			abs_vfs_path = g_strdup_printf ("file://%s", file_name);
 			file_abs_path = g_strdup (file_name);
 		}
@@ -4934,7 +4850,7 @@
 		}
 
 		if ((value1 =
-			 gda_data_model_get_value_at_col_name (GDA_DATA_MODEL (query_result),
+			 gda_data_model_get_value_at_col_name (data_model,
 												   "analyse_time", i)) == NULL)
 		{
 			continue;
@@ -4967,18 +4883,13 @@
 
 		if (difftime (db_file_time, file_info->mtime) < 0)
 		{
-			g_message ("FILES TO BE UPDATED ===> : %s [diff time %f] date string is %s", 
+/*			g_message ("FILES TO BE UPDATED ===> : %s [diff time %f] date string is %s", 
 					   file_name, difftime (db_file_time, file_info->mtime),
 					   date_string);
+*/			
 			g_ptr_array_add (files_to_scan, file_abs_path);
 		}
-/*/
-		DEBUG_PRINT ("difftime %f", difftime (db_file_time, file_info->mtime));
-		DEBUG_PRINT ("db_file_time %d - "
-				   "file_info->mtime %d "
-				   "file_info->ctime %d", db_file_time,
-				   file_info->mtime, file_info->ctime);
-//*/
+		
 		gnome_vfs_close (handle);
 		gnome_vfs_uri_unref (uri);
 		gnome_vfs_file_info_unref (file_info);
@@ -4986,9 +4897,10 @@
 		/* no need to free file_abs_path, it's been added to files_to_scan */
 	}
 	
-	if (query_result)
-		g_object_unref (query_result);
-
+	if (data_model)
+		g_object_unref (data_model);
+	g_object_unref (plist);
+	
 	if (files_to_scan->len > 0)
 	{
 		/* at the end let the scanning function do its job */
@@ -5008,17 +4920,11 @@
 	SymbolDBEnginePriv *priv;	
 	
 	g_return_val_if_fail (dbe != NULL, FALSE);
-	if (symbol_db_engine_is_project_opened (dbe, project) == FALSE) 
-	{
-		g_warning ("project is not opened");
-		return FALSE;
-	}	
-
 	priv = dbe->priv;
 	
-	if (strlen (file) < strlen (priv->data_source)) 
+	if (strlen (file) < strlen (priv->project_directory)) 
 	{
-		g_warning ("wrong file");
+		g_warning ("wrong file to delete.");
 		return FALSE;
 	}
 	
@@ -5026,7 +4932,7 @@
 	 * tuples, like sym_kind, sym_type etc */
 	query_str = g_strdup_printf ("DELETE FROM file WHERE prj_id "
 				 "= (SELECT project_id FROM project WHERE project_name = '%s') AND "
-				 "file_path = '%s'", project, file + strlen (priv->data_source));
+				 "file_path = '%s'", project, file + strlen (priv->project_directory));
 
 	sdb_engine_execute_non_select_sql (dbe, query_str);
 	g_free (query_str);
@@ -5058,11 +4964,11 @@
 		
 		DEBUG_PRINT ("processing updating for file [on disk] %s, "
 					 "passed to on_scan_update_buffer_end (): %s", 
-					 node, node + strlen (priv->data_source));
+					 node, node + strlen (priv->db_directory));
 
 		/* will be emitted removed signals */
 		if (sdb_engine_update_file (dbe, node+ 
-									strlen (priv->data_source)) == FALSE)
+									strlen (priv->db_directory)) == FALSE)
 		{
 			g_warning ("Error processing file %s", node);
 			return;
@@ -5108,12 +5014,6 @@
 	
 	DEBUG_PRINT ("symbol_db_engine_update_buffer_symbols ()");
 
-	if (symbol_db_engine_is_project_opened (dbe, project) == FALSE) 
-	{
-		g_warning ("project is not opened");
-		return FALSE;
-	}
-	
 	temp_files = g_ptr_array_new();	
 	real_files_on_db = g_ptr_array_new();
 	
@@ -5121,7 +5021,7 @@
 	for (i=0; i < real_files_list->len; i++) 
 	{
 		gchar *new_node = (gchar*)g_ptr_array_index (real_files_list, i) 
-								   + strlen (priv->data_source);
+								   + strlen (priv->db_directory);
 
 		g_ptr_array_add (real_files_on_db, g_strdup (new_node));
 	}	
@@ -5291,78 +5191,110 @@
 	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.
+
+/**
+ * tries to get all the files with zero symbols: these should be the ones
+ * excluded by an abort on population process.
+ * @return A GPtrArray with paths on disk of the files. Must be freed by caller.
+ * @return NULL if no files are found.
  */
-SymbolDBEngineIterator *
-symbol_db_engine_get_class_parents (SymbolDBEngine *dbe, const gchar *klass_name, 
-									 const GPtrArray *scope_path)
+GPtrArray *
+symbol_db_engine_get_files_with_zero_symbols (SymbolDBEngine *dbe)
 {
+	/*select * from file where file_id not in (select file_defined_id from symbol);*/
 	SymbolDBEnginePriv *priv;
+	GdaDataModel *data_model;
+	GPtrArray *files_to_scan;
+	gint i, num_rows = 0;
 	gchar *query_str;
-	GdaDataModel *data;
-	gint final_definition_id;
-	
-	g_return_val_if_fail (dbe != NULL, FALSE);
-	priv = dbe->priv;
 
+	g_return_val_if_fail (dbe != NULL, NULL);
+	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);
+/*	
+	FIXME: is this working within libgda-4x?
+	if ((query = sdb_engine_get_query_by_id (dbe,
+								 PREP_QUERY_GET_ALL_FROM_FILE_WHERE_NOT_IN_SYMBOLS))
+		== NULL)
+	{
+		g_warning ("query is null");
+		return NULL;
 	}
-	else 
+
+	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
+		gda_query_get_query_type ((GdaQuery *) query))
 	{
-		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);
+		g_warning ("non parsed sql error");
+		return NULL;
+	}
+
+	query_result =	gda_query_execute
+				  ((GdaQuery *) query, NULL, FALSE, NULL);
+*/
+	query_str = g_strdup_printf ("SELECT * FROM file WHERE file_id NOT IN (SELECT file_defined_id FROM symbol)");
+	DEBUG_PRINT ("symbol_db_engine_get_files_with_zero_symbols  () %s", query_str);
+	if ( (data_model = sdb_engine_execute_select_sql (dbe, query_str)) == NULL ||
+		  (num_rows = gda_data_model_get_n_rows (data_model)) <= 0 ) 
+	{
+		if (priv->mutex)
+			g_mutex_unlock (priv->mutex);
+		
+		return NULL;
 	}
 	
-	DEBUG_PRINT ("get parents query: %s", query_str);
+	/*
+		
+	if (!GDA_IS_DATA_MODEL (query_result) ||
+		(num_rows = gda_data_model_get_n_rows (GDA_DATA_MODEL (query_result))) <= 0)
+	{
+		if (query_result != NULL)
+			g_object_unref (query_result);
+		query_result = NULL;
+		return NULL;
+	}*/
 
-	if ( (data = sdb_engine_execute_select_sql (dbe, query_str)) == NULL ||
-		  gda_data_model_get_n_rows (data) <= 0 ) 
+	/* initialize the array */
+	files_to_scan = g_ptr_array_new ();
+
+	/* we can now scan each filename entry to check the last modification time. */
+	for (i = 0; i < num_rows; i++)
 	{
-		g_free (query_str);
-		if (priv->mutex)
-			g_mutex_unlock (priv->mutex);
-		return NULL;			  
+		const GValue *value;
+		const gchar *file_name;
+		gchar *file_abs_path = NULL;
+
+		if ((value =
+			 gda_data_model_get_value_at_col_name (data_model,
+												   "file_path", i)) == NULL)
+		{
+			continue;
+		}
+
+		/* build abs path. */
+		file_name = g_value_get_string (value);
+		if (priv->db_directory != NULL)
+		{
+			file_abs_path = g_strdup_printf ("%s%s", priv->db_directory,
+										file_name);
+		}
+		g_ptr_array_add (files_to_scan, file_abs_path);
 	}
 
 	g_free (query_str);
-
+	g_object_unref (data_model);
+	
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
-	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
-												priv->sym_type_conversion_hash);
+	
+	return files_to_scan;
 }
 
 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 +5380,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 +5703,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 +5843,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 +5939,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 +6079,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;	
@@ -6010,7 +6090,7 @@
 	g_return_val_if_fail (dbe != NULL, NULL);
 	g_return_val_if_fail (file_path != NULL, NULL);
 	priv = dbe->priv;	
-	g_return_val_if_fail (priv->data_source != NULL, NULL);
+	g_return_val_if_fail (priv->db_directory != NULL, NULL);
 
 	if (priv->mutex)
 		g_mutex_lock (priv->mutex);
@@ -6030,7 +6110,7 @@
 	/* fill info_data and join data with optional sql */
 	sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
 
-	/* rember to do a file_path + strlen(priv->data_source): a project relative 
+	/* rember to do a file_path + strlen(priv->db_directory): a project relative 
 	 * file path 
 	 */
 	query_str = g_strdup_printf ("SELECT symbol.symbol_id, symbol.name, "
@@ -6038,7 +6118,7 @@
 		"symbol.is_file_scope, symbol.signature %s FROM symbol "
 			"JOIN file ON symbol.file_defined_id = file.file_id "
 		"%s WHERE file.file_path = \"%s\"", info_data->str, join_data->str,
-								 file_path + strlen(priv->data_source));
+								 file_path + strlen(priv->db_directory));
 	
 	DEBUG_PRINT ("symbol_db_engine_get_file_symbols  (): query is %s", query_str);
 
@@ -6064,7 +6144,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;	
@@ -6126,7 +6206,7 @@
 	g_return_val_if_fail (dbe != NULL, NULL);
 	
 	priv = dbe->priv;
-	full_path = g_strdup_printf ("%s%s", priv->data_source, file);
+	full_path = g_strdup_printf ("%s%s", priv->db_directory, file);
 	return full_path;	
 }
 
@@ -6140,24 +6220,29 @@
 		
 	priv = dbe->priv;
 	
-	if (priv->data_source == NULL)
+	if (priv->db_directory == NULL)
 		return NULL;
 
-	if (strlen (priv->data_source) >= strlen (full_local_file_path)) 
+	if (strlen (priv->db_directory) >= strlen (full_local_file_path)) 
 	{
 		return NULL;
 	}
 
-	tmp = full_local_file_path + strlen (priv->data_source);
+	tmp = full_local_file_path + strlen (priv->db_directory);
 	relative_path = strdup (tmp);
 
 	return relative_path;
 }
 
 
+/**
+ * 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 +6275,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 +6327,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 +6338,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 +6529,148 @@
 	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: trunk/plugins/symbol-db/symbol-db-engine.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine.h	Thu Apr  3 16:02:35 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
@@ -95,52 +95,52 @@
 
 /**
  * Open or create a new database. 
- * Be sure to give a base_prj_path with the ending '/' for directory.
- * E.g: a project on '/tmp/foo/' dir.
+ * Be sure to give a base_db_path with the ending '/' for directory.
+ * @param base_db_path directory where .anjuta_sym_db.db will be stored. It can be
+ *        different from project_directory
+ *        E.g: a db on '/tmp/foo/' dir.
+ * @param prj_directory project directory. It may be different from base_db_path.
+ *        It's mainly used to map files inside the db. Say for example that you want to
+ *        add to a project a file /home/user/project/foo_prj/src/file.c with a project
+ *        directory of /home/user/project/foo_prj/. On db it'll be represented as
+ *        src/file.c. In this way you can move around the project dir without dealing
+ *        with relative paths.
  */
 gboolean 
-symbol_db_engine_open_db (SymbolDBEngine *dbe, const gchar* base_prj_path);
+symbol_db_engine_open_db (SymbolDBEngine *dbe, const gchar* base_db_path,
+						  const gchar * prj_directory);
+
+
+/** Disconnect db, gda client and db_connection */
+gboolean 
+symbol_db_engine_close_db (SymbolDBEngine *dbe);
+
 
 /**
- * Check if the database already exists into the prj_directory
+ * Check if the database already exists into the db_directory
  */
 gboolean
-symbol_db_engine_db_exists (SymbolDBEngine * dbe, const gchar * prj_directory);
-
+symbol_db_engine_db_exists (SymbolDBEngine * dbe, const gchar * db_directory);
 
-/** Add a new workspace to database. */
+/** Add a new workspace to an opened database. */
 gboolean 
 symbol_db_engine_add_new_workspace (SymbolDBEngine *dbe, const gchar* workspace);
 
 
-/** Add a new project to workspace.*/
+/** Add a new project to workspace to an opened database.*/
 gboolean 
 symbol_db_engine_add_new_project (SymbolDBEngine *dbe, const gchar* workspace, 
 								  const gchar* project);
 
-/**
- * Return the name of the opened project.
- * NULL on error. Returned string must be freed by caller.
- */
-gchar*
-symbol_db_engine_get_opened_project_name (SymbolDBEngine * dbe);
-
-
 /** 
- * Open a project. Return false if project isn't created/opened. 
- * This function *must* be called before any other operation on db.
- * Another option would be create a fresh new project: that way will also open it.
+ * Test project existence. 
+ * @return false if project isn't found
  */ 
 gboolean 
-symbol_db_engine_open_project (SymbolDBEngine *dbe, /*gchar* workspace, */
+symbol_db_engine_project_exists (SymbolDBEngine *dbe, /*gchar* workspace, */
 								  const gchar* project_name);
 
 
-/** Disconnect db, gda client and db_connection and close the project */
-gboolean 
-symbol_db_engine_close_project (SymbolDBEngine *dbe, const gchar* project_name);
-
-
 /** 
  * Add a group of files of a single language to a project. It will perform also 
  * a symbols scannig/populating of db if scan_symbols is TRUE.
@@ -148,6 +148,9 @@
  * symbol_db_engine_open_db ().
  * @note if some file fails to enter the db the function will return without
  * processing the remaining files.
+ * @param project_name something like 'foo_project', or 'helloworld_project'
+ * @param project_directory something like the base path '/home/user/projects/foo_project/'
+ *        Be sure not to exchange the db_directory with project_directory! they're different!
  * @param files_path requires full path to files on disk. Ctags itself requires that.
  *        it must be something like "/home/path/to/my/foo/file.xyz". Also it requires
  *		  a language string to represent the file.
@@ -158,9 +161,11 @@
  *		  elments that files_path has. It should be populated like this: "C", "C++",
  *		  "Java"
  * 		  This is done to be uniform to the language-manager plugin.
+ * @return true is insertion is successful.
  */
 gboolean 
-symbol_db_engine_add_new_files (SymbolDBEngine *dbe, const gchar* project,
+symbol_db_engine_add_new_files (SymbolDBEngine *dbe, 
+								const gchar * project_name,
 							    const GPtrArray *files_path,
 								const GPtrArray *languages,
 								gboolean scan_symbols);
@@ -214,20 +219,60 @@
 gchar*
 symbol_db_engine_get_file_db_path (SymbolDBEngine *dbe, const gchar* full_local_file_path);
 
+/** 
+ * 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);
 
 /**
- * Will test the opened project within the dbe plugin and the passed one.
+ * Return a GPtrArray that must be freed from caller.
  */
-gboolean inline
-symbol_db_engine_is_project_opened (SymbolDBEngine *dbe, const gchar* project_name);
+GPtrArray *
+symbol_db_engine_fill_type_array (IAnjutaSymbolType match_types);
 
 /**
- * Return an iterator to the data retrieved from database. 
- * It will be possible to get the scope specified by the line of the file. 
+ * Try to get all the files with zero symbols: these should be the ones
+ * excluded by an abort on population process.
+ * @return A GPtrArray with paths on disk of the files. Must be freed by caller.
+ * @return NULL if no files are found.
+ */
+GPtrArray *
+symbol_db_engine_get_files_with_zero_symbols (SymbolDBEngine *dbe);
+
+
+/**********************
+ * 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 +281,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 +343,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 +354,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
 

Added: trunk/plugins/symbol-db/symbol-db-prefs.c
==============================================================================
--- (empty file)
+++ trunk/plugins/symbol-db/symbol-db-prefs.c	Thu Apr  3 16:02:35 2008
@@ -0,0 +1,656 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * symbol-db-prefs.c
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
+ * 
+ * plugin.c is free software.
+ * 
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ * 
+ * plugin.c is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with plugin.c.  If not, write to:
+ * 	The Free Software Foundation, Inc.,
+ * 	51 Franklin Street, Fifth Floor
+ * 	Boston, MA  02110-1301, USA.
+ */
+
+#include <config.h>
+#include <ctype.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <dirent.h>
+#include <string.h>
+#include <gtk/gtktreeview.h>
+#include <gtk/gtkliststore.h>
+#include <libgnomevfs/gnome-vfs.h>
+#include <libanjuta/anjuta-debug.h>
+#include <libanjuta/anjuta-launcher.h>
+#include <libanjuta/interfaces/ianjuta-language.h>
+
+#include "symbol-db-prefs.h"
+
+#define GLADE_FILE PACKAGE_DATA_DIR"/glade/anjuta-symbol-db.glade"
+#define GLADE_ROOT "symbol_prefs"
+#define ICON_FILE "anjuta-symbol-db-plugin-48.png"
+
+#define CTAGS_PREFS_KEY		"ctags.executable"
+#define CTAGS_PATH			"/usr/bin/ctags"
+#define CHOOSER_WIDGET		"preferences_folder:text:/:0:symboldb.root"
+
+static AnjutaLauncher* cflags_launcher = NULL;
+static GList *pkg_list = NULL;
+static gboolean initialized = FALSE;
+
+enum
+{
+	COLUMN_LOAD,
+	COLUMN_NAME,
+	COLUMN_FLAGS_LIST,
+	COLUMN_MAX
+};
+
+typedef struct _CflagsData {
+	SymbolDBPlugin *sdb_plugin;
+	GList *item;
+} CflagsData;
+
+static void 
+on_prefs_executable_changed (GtkFileChooser *chooser,
+                             gpointer user_data)
+{
+	gchar *new_file;
+	
+	new_file = gtk_file_chooser_get_filename (chooser);
+	DEBUG_PRINT ("on_prefs_executable_changed ()");
+	DEBUG_PRINT ("new file selected %s", new_file);
+	anjuta_preferences_set (ANJUTA_PREFERENCES (user_data), CTAGS_PREFS_KEY,
+							new_file);
+	
+	g_free (new_file);
+}
+
+static void
+on_gconf_notify_prefs (GConfClient *gclient, guint cnxn_id,
+					   GConfEntry *entry, gpointer user_data)
+{
+	DEBUG_PRINT ("on_gconf_notify_prefs ()");
+}
+
+static gint 
+pkg_list_compare (gconstpointer a, gconstpointer b)
+{
+	return strcmp ((const gchar*)a, (const gchar*)b);
+}
+
+static void
+on_cflags_output (AnjutaLauncher * launcher,
+					AnjutaLauncherOutputType output_type,
+					const gchar * chars, gpointer user_data)
+{
+	SymbolDBPlugin *sdb_plugin;
+	GtkListStore *store;
+	GList *item;
+	CflagsData *cdata;
+	gchar **flags;
+	const gchar *curr_flag;
+	gint i;
+	GList *good_flags;
+	
+	cdata = (CflagsData*)user_data;
+	item = cdata->item;		
+	sdb_plugin = cdata->sdb_plugin;
+	store = sdb_plugin->prefs_list_store;
+	
+/*	DEBUG_PRINT ("on_cflags_output for item %s ->%s<-", item->data, chars);*/
+	
+	if (output_type == ANJUTA_LAUNCHER_OUTPUT_STDERR)
+	{
+		/* no way. We don't like errors on stderr... */
+		return;
+	}
+	
+	/* We should receive here something like 
+	* '-I/usr/include/gimp-2.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include'.
+	* Split up the chars and take a decision if we like it or not.
+	*/
+	flags = g_strsplit (chars, " ", -1);
+
+	i = 0;
+	/* if, after the while loop, good_flags is != NULL that means that we found
+	 * some good flags to include for a future scan 
+	 */
+	good_flags = NULL;
+	while ((curr_flag = flags[i++]) != NULL)
+	{
+		/* '-I/usr/include/gimp-2.0' would be good, but '/usr/include/' wouldn't. */
+		if (g_regex_match_simple ("\\.*/usr/include/\\w+", curr_flag, 0, 0) == TRUE)
+		{
+			/* FIXME the +2. It's to skip the -I */
+			DEBUG_PRINT ("adding %s to good_flags", curr_flag +2);
+			/* FIXME the +2. It's to skip the -I */
+			good_flags = g_list_prepend (good_flags, g_strdup (curr_flag + 2));
+		}
+	}	
+
+	g_strfreev (flags);
+
+	if (good_flags != NULL)
+	{
+		GtkTreeIter iter;
+		/* that's good. We can add the package to the GtkListStore */
+		gtk_list_store_append (store, &iter);
+		gtk_list_store_set (store, &iter, COLUMN_LOAD, FALSE,
+										COLUMN_NAME, g_strdup (item->data), 
+										COLUMN_FLAGS_LIST, good_flags, -1);
+	}
+}
+
+static void
+on_cflags_exit (AnjutaLauncher * launcher, int child_pid,
+				   int exit_status, gulong time_taken_in_seconds,
+				   gpointer user_data)
+{
+	CflagsData *cdata;
+	GList *item;	
+	gchar *exe_string;	
+	SymbolDBPlugin *sdb_plugin;
+	
+	cdata = (CflagsData*)user_data;
+	item = cdata->item;
+	sdb_plugin = cdata->sdb_plugin;
+	
+	/* select next item in the list. If it's null then free everything */
+	item = item->next;
+	if (item == NULL)
+	{
+		g_object_unref (cflags_launcher);
+		cflags_launcher = NULL;
+		g_free (cdata);
+		DEBUG_PRINT ("reached end of packages list");
+		return;
+	}
+
+	if (cflags_launcher)
+	{
+		/* recreate anjuta_launcher because.. well.. it closes stdout pipe
+		 * and stderr. There's no way to reactivate them 
+		 */
+		g_object_unref (cflags_launcher);
+		cflags_launcher = anjuta_launcher_new ();
+	}
+
+	
+	DEBUG_PRINT ("package for CFLAGS %s", (gchar*)item->data);
+
+
+	/* reuse CflagsData object to store the new glist pointer */
+	cdata->item = item;
+	/* sdb_plugin remains the same */
+	
+	g_signal_connect (G_OBJECT (cflags_launcher), "child-exited",
+				  G_CALLBACK (on_cflags_exit), cdata);	
+	
+	exe_string = g_strdup_printf ("pkg-config --cflags %s", (gchar*)item->data);
+	DEBUG_PRINT ("launching exe_string  %s", exe_string );
+	
+	anjuta_launcher_execute (cflags_launcher,
+						 exe_string, on_cflags_output, 
+						 cdata);
+		
+	g_free (exe_string);
+}
+
+static void
+on_listall_output (AnjutaLauncher * launcher,
+					AnjutaLauncherOutputType output_type,
+					const gchar * chars, gpointer user_data)
+{
+	if (output_type == ANJUTA_LAUNCHER_OUTPUT_STDERR)
+		return;
+	
+	/* there's no way to avoid getting stderr here. */
+	DEBUG_PRINT ("chars %s", chars);
+	gchar **lines;
+	const gchar *curr_line;
+	gint i = 0;
+	SymbolDBPlugin *sdb_plugin;
+	GtkListStore *store;
+		
+	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (user_data);
+	
+	store = sdb_plugin->prefs_list_store;
+	
+	lines = g_strsplit (chars, "\n", -1);
+	
+	while ((curr_line = lines[i++]) != NULL)
+	{
+		gchar **pkgs;
+		
+		pkgs = g_strsplit (curr_line, " ", -1);
+		
+		/* just take the first one as it's the package-name */
+		if (pkgs == NULL)
+			return;		
+		
+		if (pkgs[0] == NULL) {
+			g_strfreev (pkgs);
+			continue;
+		}
+		DEBUG_PRINT ("pkg inserted into pkg_list is %s", pkgs[0]);		
+/*		
+		gtk_list_store_append (store, &iter);
+		gtk_list_store_set (store, &iter, COLUMN_LOAD, FALSE,
+									COLUMN_NAME, pkgs[0], 
+									COLUMN_FLAGS_LIST, NULL, -1);
+*/		
+		pkg_list = g_list_prepend (pkg_list, g_strdup (pkgs[0]));
+		g_strfreev (pkgs);
+	}
+
+	g_strfreev (lines);	
+}
+
+static void
+on_listall_exit (AnjutaLauncher * launcher, int child_pid,
+				   int exit_status, gulong time_taken_in_seconds,
+				   gpointer user_data)
+{	
+	SymbolDBPlugin *sdb_plugin;
+	CflagsData *cdata;
+	gchar *exe_string;
+	
+	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (user_data);
+	
+
+	DEBUG_PRINT ("launcher ended");
+	/* we should have pkg_list filled with packages names 
+	 * It's not enough anyway: we have to 1. sort alphabetically the list first
+	 * then 2. check for Iflags [pkg-config --cflags] if the regex returns void 
+	 * then kill the package from the list
+	 */
+		
+	if (pkg_list == NULL)
+	{
+		g_warning ("No packages found");
+		return;
+	}
+
+	pkg_list = g_list_sort (pkg_list, pkg_list_compare);
+
+	if (cflags_launcher == NULL)
+		cflags_launcher = anjuta_launcher_new ();
+	
+	cdata = g_new0 (CflagsData, 1);
+	
+	cdata->sdb_plugin = sdb_plugin;
+	cdata->item = pkg_list;
+	
+	DEBUG_PRINT ("package for CFLAGS %s", (gchar*)pkg_list->data);
+
+	g_signal_connect (G_OBJECT (cflags_launcher), "child-exited",
+				  G_CALLBACK (on_cflags_exit), cdata);	
+	
+	exe_string = g_strdup_printf ("pkg-config --cflags %s", (gchar*)pkg_list->data);
+	
+	anjuta_launcher_execute (cflags_launcher,
+						 exe_string, on_cflags_output, 
+						 cdata);
+		
+	g_free (exe_string);
+}
+
+static GList **
+files_visit_dir (GList **files_list, const gchar* uri)
+{
+	
+	GList *files_in_curr_dir = NULL;
+	
+	if (gnome_vfs_directory_list_load (&files_in_curr_dir, uri,
+								   GNOME_VFS_FILE_INFO_GET_MIME_TYPE) == GNOME_VFS_OK) 
+	{
+		GList *node;
+		node = files_in_curr_dir;
+		do {
+			GnomeVFSFileInfo* info;
+						
+			info = node->data;
+			
+			if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) {
+				
+				if (strcmp (info->name, ".") == 0 ||
+					strcmp (info->name, "..") == 0)
+					continue;
+
+				g_message ("node [DIRECTORY]: %s", info->name);				
+				gchar *tmp = g_strdup_printf ("%s/%s", uri, info->name);
+				
+				g_message ("recursing for: %s", tmp);
+				/* recurse */
+				files_list = files_visit_dir (files_list, tmp);
+				
+				g_free (tmp);
+			}
+			else {
+				gchar *local_path;
+				gchar *tmp = g_strdup_printf ("%s/%s", 
+									uri, info->name);
+			
+				g_message ("prepending %s", tmp);
+				local_path = gnome_vfs_get_local_path_from_uri (tmp);
+				*files_list = g_list_prepend (*files_list, local_path);
+				g_free (tmp);
+			}
+		} while ((node = node->next) != NULL);		
+	}	 
+	
+	return files_list;
+}
+
+static void
+on_tag_load_toggled (GtkCellRendererToggle *cell, char *path_str,
+					 SymbolDBPlugin *sdb_plugin)
+{
+	GtkTreeIter iter;
+	GtkTreePath *path;
+	gboolean enabled;
+	GList *enabled_packages;
+	gchar *curr_package_name;
+	GtkListStore *store;
+	AnjutaStatus *status;
+	GList * node;
+	GPtrArray *files_to_scan_array;
+	GPtrArray *languages_array;
+	IAnjutaLanguage* lang_manager;
+	
+	DEBUG_PRINT ("on_tag_load_toggled ()");
+	lang_manager = anjuta_shell_get_interface (ANJUTA_PLUGIN(sdb_plugin)->shell, 
+													IAnjutaLanguage, NULL);
+	
+	
+	status = anjuta_shell_get_status (ANJUTA_PLUGIN (sdb_plugin)->shell, NULL);
+	store = sdb_plugin->prefs_list_store;
+	
+	anjuta_status_busy_push (status);
+	
+	path = gtk_tree_path_new_from_string (path_str);
+	gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &iter, path);
+	gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
+						COLUMN_LOAD, &enabled,
+						COLUMN_NAME, &curr_package_name,
+						COLUMN_FLAGS_LIST, &enabled_packages,
+						-1);
+	enabled = !enabled;
+	gtk_list_store_set (store, &iter, COLUMN_LOAD, enabled, -1);
+	gtk_tree_path_free (path);
+		
+	node = enabled_packages;	
+	
+	/* if we have some packages then initialize the array that will be passed to
+	 * the engine */
+	if (node != NULL)
+	{
+		files_to_scan_array = g_ptr_array_new ();
+		languages_array = g_ptr_array_new();
+	}
+	else
+		return;
+	
+	do {
+		GList *files_tmp_list = NULL;
+		gchar *uri;
+/*		g_message ("package %s has node : %s", curr_package_name, node->data);*/
+		
+		uri = gnome_vfs_get_uri_from_local_path (node->data);
+		
+		/* files_tmp_list needs to be freed */
+		files_visit_dir (&files_tmp_list, uri);
+		g_free (uri);
+		
+		if (files_tmp_list != NULL) 
+		{			
+			/* last loop here. With files_visit_dir we'll retrieve all files nodes
+			 * under the passed directory 
+			 */
+			GList *tmp_node;
+			tmp_node = files_tmp_list;
+			do {
+				const gchar* file_mime;
+				IAnjutaLanguageId lang_id;
+				const gchar* lang;
+				file_mime = gnome_vfs_get_mime_type_for_name (tmp_node->data);
+		
+				lang_id = ianjuta_language_get_from_mime_type (lang_manager, file_mime, 
+													   NULL);
+		
+				/* No supported language... */
+				if (!lang_id)
+				{
+					continue;
+				}
+			
+				lang = ianjuta_language_get_name (lang_manager, lang_id, NULL);				
+		
+				g_ptr_array_add (languages_array, g_strdup (lang));				
+				g_ptr_array_add (files_to_scan_array, g_strdup (tmp_node->data));
+			} while ((tmp_node = tmp_node->next) != NULL);		
+			
+			/* free the tmp files list */
+			g_list_foreach (files_tmp_list, (GFunc)g_free, NULL);
+			g_list_free (files_tmp_list);
+		}
+		
+		/* great. Launch the population, if we had something on files_to_scan_array */
+		if (files_to_scan_array != NULL) 
+		{
+			DEBUG_PRINT ("adding new project to db_plugin->sdbe_globals %s ", 
+						 curr_package_name);
+			symbol_db_engine_add_new_project (sdb_plugin->sdbe_globals,
+											  NULL,
+											  curr_package_name);
+			
+			symbol_db_engine_add_new_files (sdb_plugin->sdbe_globals,
+											curr_package_name, 
+											files_to_scan_array,
+											languages_array,
+											TRUE);
+		}
+		
+	} while ((node = node->next) != NULL);		
+	
+	
+#if 0		
+	enabled_paths = NULL;
+	if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter))
+	{
+		do
+		{
+			gtk_tree_model_get (GTK_TREE_MODEL (store), &iter,
+								COLUMN_LOAD, &enabled,
+								COLUMN_PATH, &tag_path,
+								-1);
+			if (enabled)
+				enabled_paths = g_list_prepend (enabled_paths, tag_path);
+			
+		}
+		while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &iter));
+	}
+	
+	if (enabled_paths)
+	{
+		GList *node;
+		GString *str;
+		gboolean first;
+		gchar *final_str;
+		
+		enabled_paths = g_list_sort (enabled_paths, (GCompareFunc)strcmp);
+		node = enabled_paths;
+		str = g_string_new ("");
+		first = TRUE;
+		while (node)
+		{
+			if (first)
+			{
+				first = FALSE;
+				str = g_string_append (str, (const gchar*) node->data);
+			}
+			else
+			{
+				str = g_string_append (str, ":");
+				str = g_string_append (str, (const gchar*) node->data);
+			}
+			node = g_list_next (node);
+		}
+		
+		/* Update preferences */
+		final_str = g_string_free (str, FALSE);
+		anjuta_preferences_set (prefs, SYMBOL_BROWSER_TAGS, final_str);
+		
+		/* Update system tags cache */
+		if (enabled)
+		{
+			update_system_tags_only_add (tag_path);
+		}
+		else
+		{
+			update_system_tags (enabled_paths);
+			g_free (final_str);
+		}
+	}
+	else
+	{
+		/* Unset key and clear all tags */
+		anjuta_preferences_set (prefs, SYMBOL_BROWSER_TAGS, "");
+	}
+	g_list_foreach (enabled_paths, (GFunc)g_free, NULL);
+	g_list_free (enabled_paths);
+	anjuta_status_busy_pop (status);
+#endif	
+}
+
+void 
+symbol_db_prefs_init (SymbolDBPlugin *sdb_plugin, AnjutaPreferences *prefs)
+{
+	GladeXML *gxml;
+	GtkWidget *fchooser, *treeview;
+	GtkCellRenderer *renderer;
+	GtkTreeViewColumn *column;
+	gchar *ctags_value;
+	gchar* exe_string = NULL;
+	gboolean require_scan = FALSE;		/* scan for packages */
+	
+	g_return_if_fail (sdb_plugin != NULL);
+	DEBUG_PRINT ("symbol_db_prefs_init ()");
+	
+	if (initialized)
+		return;
+	
+	/* Create the preferences page */
+	gxml = glade_xml_new (GLADE_FILE, GLADE_ROOT, NULL);	
+		
+	fchooser = 	glade_xml_get_widget (gxml, CHOOSER_WIDGET);
+			
+	anjuta_preferences_add_page (prefs, gxml, GLADE_ROOT, _("Symbol Database"),  
+								 ICON_FILE);
+	ctags_value = anjuta_preferences_get (prefs, CTAGS_PREFS_KEY);
+	
+	if (ctags_value == NULL) 
+	{
+		ctags_value = g_strdup (CTAGS_PATH);
+	}
+	
+	if (gtk_file_chooser_select_filename (GTK_FILE_CHOOSER (fchooser), ctags_value) 
+						== FALSE )
+	{
+		DEBUG_PRINT ("error: could not select file uri with gtk_file_chooser_select_filename ()");
+	}
+	
+	g_signal_connect (G_OBJECT (fchooser), "selection-changed",
+					  G_CALLBACK (on_prefs_executable_changed), prefs);
+
+	sdb_plugin->prefs_notify_id = anjuta_preferences_notify_add (prefs, CTAGS_PREFS_KEY, 
+											   on_gconf_notify_prefs, prefs, NULL);	
+	
+	
+	/* init GtkListStore */
+	if (sdb_plugin->prefs_list_store == NULL) 
+	{
+		sdb_plugin->prefs_list_store = gtk_list_store_new (COLUMN_MAX, G_TYPE_BOOLEAN, 
+													   G_TYPE_STRING, G_TYPE_POINTER);
+		require_scan = TRUE;
+	}
+	treeview = glade_xml_get_widget (gxml, "tags_treeview");
+	gtk_tree_view_set_model (GTK_TREE_VIEW (treeview),
+							 GTK_TREE_MODEL (sdb_plugin->prefs_list_store));
+
+	/* Add the column for stock treeview */
+	renderer = gtk_cell_renderer_toggle_new ();
+	g_signal_connect (G_OBJECT (renderer), "toggled",
+					  G_CALLBACK (on_tag_load_toggled), sdb_plugin);
+	column = gtk_tree_view_column_new_with_attributes (_("Load"),
+													   renderer,
+													   "active",
+													   COLUMN_LOAD,
+													   NULL);
+	gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+	
+	renderer = gtk_cell_renderer_text_new ();
+	column = gtk_tree_view_column_new_with_attributes (_("API Tags"),
+													  renderer, "text",
+													  COLUMN_NAME,
+													  NULL);
+	gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+	gtk_tree_view_column_set_sizing (column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+	gtk_tree_view_set_search_column (GTK_TREE_VIEW (treeview),
+									 COLUMN_NAME);
+	
+	/* listall launcher thing */
+	if (require_scan == TRUE) 
+	{
+		sdb_plugin->pkg_config_launcher = anjuta_launcher_new ();
+
+		anjuta_launcher_set_check_passwd_prompt (sdb_plugin->pkg_config_launcher, FALSE);
+		g_signal_connect (G_OBJECT (sdb_plugin->pkg_config_launcher), "child-exited",
+					  	G_CALLBACK (on_listall_exit), sdb_plugin);	
+	
+		exe_string = g_strdup ("pkg-config --list-all");
+	
+		anjuta_launcher_execute (sdb_plugin->pkg_config_launcher,
+							 	exe_string, on_listall_output, 
+							 	sdb_plugin);
+	}
+	
+	/* unrefs unused memory objects */
+	g_object_unref (gxml);
+	g_free (ctags_value);
+	g_free (exe_string);
+	
+	/* pkg_tmp_file will be released on launcher_exit */
+	
+	initialized = TRUE;
+}
+
+void 
+symbol_db_prefs_finalize (SymbolDBPlugin *sdb_plugin, AnjutaPreferences *prefs)
+{	
+	DEBUG_PRINT ("symbol_db_prefs_finalize ()");
+	anjuta_preferences_notify_remove(prefs, sdb_plugin->prefs_notify_id);
+	anjuta_preferences_remove_page(prefs, _("Symbol Database"));
+
+	g_object_unref (cflags_launcher);
+	cflags_launcher = NULL;
+	
+	/* free pkg_list */
+	g_list_foreach (pkg_list, (GFunc)g_free, NULL);
+	g_list_free (pkg_list);
+	pkg_list = NULL;
+	
+	initialized = FALSE;
+}

Added: trunk/plugins/symbol-db/symbol-db-prefs.h
==============================================================================
--- (empty file)
+++ trunk/plugins/symbol-db/symbol-db-prefs.h	Thu Apr  3 16:02:35 2008
@@ -0,0 +1,35 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * symbol-db-prefs.h
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
+ * 
+ * plugin.c is free software.
+ * 
+ * You may redistribute it and/or modify it under the terms of the
+ * GNU General Public License, as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ * 
+ * plugin.c is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with plugin.c.  If not, write to:
+ * 	The Free Software Foundation, Inc.,
+ * 	51 Franklin Street, Fifth Floor
+ * 	Boston, MA  02110-1301, USA.
+ */
+
+#ifndef __SYMBOL_DB_PREFS_H__
+#define __SYMBOL_DB_PREFS_H__
+
+#include "plugin.h"
+
+void symbol_db_prefs_init (SymbolDBPlugin *plugin, AnjutaPreferences *prefs);
+void symbol_db_prefs_finalize (SymbolDBPlugin *plugin, AnjutaPreferences *prefs);
+/*
+void symbol_db_load_global_tags (gpointer plugin);
+*/
+#endif

Modified: trunk/plugins/symbol-db/symbol-db-view-locals.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view-locals.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-view-locals.c	Thu Apr  3 16:02:35 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: trunk/plugins/symbol-db/symbol-db-view.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-view.c	Thu Apr  3 16:02:35 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;
 	}
 			
@@ -525,9 +524,6 @@
 
 		if (curr_tree_row_ref == NULL)
 		{
-			g_warning ("prepare_for_adding (): row_ref == NULL. symbol_name %s "
-					   "symbol_id %d kind %s parent_symbol_id %d", 
-					   symbol_name, symbol_id, kind, parent_symbol_id);
 			return;
 		}		
 		
@@ -767,7 +763,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 +816,6 @@
 	NodeIdleExpand *node_expand;
 	SymbolDBView *dbv;
 	SymbolDBEngine *dbe;
-	SymbolDBEngineIterator *iterator;
 	
 	g_return_if_fail (data != NULL);
 	node_expand = data;	
@@ -892,7 +886,6 @@
 										symbol_name, curr_symbol_id);
 	if (curr_tree_row_ref == NULL)
 	{
-		g_warning ("sdb_view_global_row_expanded (): row_ref == NULL");
 		return symbol_db_engine_iterator_move_next (iterator);
 	}		
 		
@@ -978,13 +971,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 +1068,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 +1121,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
 									);
 	}
 	
@@ -1724,7 +1715,6 @@
 												symbol_name, curr_symbol_id);
 			if (curr_tree_row_ref == NULL)
 			{
-				g_warning ("sdb_view_build_and_display_base_tree (): row_ref == NULL");
 				continue;
 			}		
 		
@@ -1756,7 +1746,6 @@
 		
 	if (global_tree_row_ref == NULL)
 	{
-		g_warning ("sdb_view_build_and_display_base_tree (): row_ref == NULL");
 		return;
 	}		
 	g_tree_insert (priv->nodes_displayed, (gpointer)ROOT_GLOBAL, 

Modified: trunk/plugins/symbol-db/symbol-db.ui
==============================================================================
--- trunk/plugins/symbol-db/symbol-db.ui	(original)
+++ trunk/plugins/symbol-db/symbol-db.ui	Thu Apr  3 16:02:35 2008
@@ -1,6 +0,0 @@
-<!--*- xml -*-->
-<ui>
-	<toolbar name="ToolbarSymbolsDB">
-		<toolitem name="SymbolDB" action="ActionGotoSymbolDB"/>
-	</toolbar>
-</ui>

Modified: trunk/plugins/symbol-db/tables.sql
==============================================================================
--- trunk/plugins/symbol-db/tables.sql	(original)
+++ trunk/plugins/symbol-db/tables.sql	Thu Apr  3 16:02:35 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;

Modified: trunk/plugins/symbol-db/test/Makefile.am
==============================================================================
--- trunk/plugins/symbol-db/test/Makefile.am	(original)
+++ trunk/plugins/symbol-db/test/Makefile.am	Thu Apr  3 16:02:35 2008
@@ -1,6 +1,6 @@
 
 bin_PROGRAMS = \
-	test-symbol-db 
+	benchmark 
 
 AM_CPPFLAGS = \
 	-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
@@ -12,8 +12,10 @@
 	-DPACKAGE_SRC_DIR=\"$(srcdir)\" \
 	$(LIBANJUTA_CFLAGS) \
 	$(PLUGIN_SYMBOL_DB_CFLAGS) \
-	$(GDL_CFLAGS)
+	$(GDL_CFLAGS) \
+	-DDEBUG
 
+AM_CFLAGS = -g -pg
 
 test_symbol_db_SOURCES = \
 	main.c       \
@@ -26,13 +28,53 @@
 	../symbol-db-engine-iterator-node.c \
 	../symbol-db-engine-iterator-node.h \
 	../symbol-db-view.h \
-	../symbol-db-view.c 
+	../symbol-db-view.c \
+	pkg.c \
+	pkg.h \
+	parse.c \
+	parse.h
  
 
 test_symbol_db_LDFLAGS = \
 	$(LIBANJUTA_LIBS) \
 	$(PLUGIN_SYMBOL_DB_LIBS)
 
+benchmark_SOURCES = \
+	benchmark.c       \
+	../readtags.c       \
+	../readtags.h       \
+	../symbol-db-engine.c       \
+	../symbol-db-engine.h       \
+	../symbol-db-engine-iterator.c       \
+	../symbol-db-engine-iterator.h \
+	../symbol-db-engine-iterator-node.c \
+	../symbol-db-engine-iterator-node.h \
+	../symbol-db-view.h \
+	../symbol-db-view.c
+ 
+
+benchmark_LDFLAGS = \
+	$(LIBANJUTA_LIBS) \
+	$(PLUGIN_SYMBOL_DB_LIBS)
+
+
+gda_2_connections_bug_SOURCES = \
+	gda_two_connections_bug.c       \
+	../readtags.c       \
+	../readtags.h       \
+	../symbol-db-engine.c       \
+	../symbol-db-engine.h       \
+	../symbol-db-engine-iterator.c       \
+	../symbol-db-engine-iterator.h \
+	../symbol-db-engine-iterator-node.c \
+	../symbol-db-engine-iterator-node.h \
+	../symbol-db-view.h \
+	../symbol-db-view.c
+
+gda_2_connections_bug_LDFLAGS = \
+	$(LIBANJUTA_LIBS) \
+	$(PLUGIN_SYMBOL_DB_LIBS)
+
 ## File created by the gnome-build tools
 
 

Modified: trunk/plugins/symbol-db/test/main.c
==============================================================================
--- trunk/plugins/symbol-db/test/main.c	(original)
+++ trunk/plugins/symbol-db/test/main.c	Thu Apr  3 16:02:35 2008
@@ -101,6 +101,7 @@
 static void
 get_parents (SymbolDBEngine *dbe)
 {
+#if 0	
 	gint i;
 	GPtrArray *scope_path;	
 	scope_path = g_ptr_array_new();	
@@ -123,6 +124,7 @@
 			symbol_db_engine_get_class_parents (dbe, "YourClass", NULL);
 	
 	dump_iterator (iterator);
+#endif	
 }
 
 static void
@@ -314,10 +316,11 @@
 
 #endif
 
-#if 0
+#if 1
 int main(int argc, char** argv)
 {
-	SymbolDBEngine *dbe;
+	SymbolDBEngine *dbe_one;
+	SymbolDBEngine *dbe_two;
 	tagFile *tag_file;
 	tagFileInfo tag_file_info;
 	tagEntry tag_entry;
@@ -326,31 +329,50 @@
 	gnome_vfs_init ();
     g_type_init();
 	gda_init ("Test db", "0.1", argc, argv);
-	dbe = symbol_db_engine_new ();
-	
-	gchar *prj_dir = "/home/pescio/Projects/entwickler-0.1";
-
-	g_message ("opening database");
-	if (symbol_db_engine_open_db (dbe, prj_dir) == FALSE)
-		g_message ("error in opening db");
 	
-//	g_message ("adding new workspace");
-//	if (symbol_db_engine_add_new_workspace (dbe, "foo_workspace") == FALSE)
-//		g_message ("error adding workspace");
+	dbe_one = symbol_db_engine_new ();
+	dbe_two = symbol_db_engine_new ();
 	
-//	g_message ("adding new project");
-//	if (symbol_db_engine_add_new_project (dbe, NULL, "foo_project") == FALSE)
-//		g_message ("error in adding project");
+	gchar *prj_dir_one = "/home/pescio/Projects/entwickler-0.1";
+
+	g_message ("opening database ONE");
+	if (symbol_db_engine_open_db (dbe_one, prj_dir_one, prj_dir_one) == FALSE)
+		g_message ("error in opening db 1");
 	
-	g_message ("opening project");
-	if (symbol_db_engine_open_project (dbe, "/home/pescio/Projects/entwickler-0.1") == FALSE)
-		g_message ("error in opening project");	
+	g_message ("opening project ONE");
+	if (symbol_db_engine_add_new_project (dbe_one, NULL, "project_one") == FALSE)
+		g_message ("error in opening project 1");	
+
+
+	gchar *prj_dir_two = "/home/pescio/Projects/foobar-sample";
+
+	g_message ("opening database TWO");
+	if (symbol_db_engine_open_db (dbe_two, prj_dir_two, prj_dir_two) == FALSE)
+		g_message ("error in opening db 2");
 	
+	g_message ("opening project TWO");
+	if (symbol_db_engine_add_new_project (dbe_two, NULL, "project_two") == FALSE)
+		g_message ("error in opening project 2");	
 
 	
-//	g_message ("adding files...");
-//	add_new_files  (dbe);
+	/* ------ add files ------ */
+
+	g_message ("adding files to ONE");
+	GPtrArray * files_array_one = g_ptr_array_new();	
+	GPtrArray * languages_one = g_ptr_array_new ();
+	g_ptr_array_add (files_array_one, g_strdup("/home/pescio/Projects/entwickler-0.1/entwickler/app.cc"));	
+	g_ptr_array_add (languages_one, g_strdup ("C"));
+	symbol_db_engine_add_new_files (dbe_one, "project_one", files_array_one, languages_one, TRUE);
 
+	
+	g_message ("adding files to TWO");
+	GPtrArray * files_array_two = g_ptr_array_new();	
+	GPtrArray * languages_two = g_ptr_array_new ();
+	g_ptr_array_add (files_array_two, g_strdup("/home/pescio/Projects/foobar-sample/src/main.c"));	
+	g_ptr_array_add (languages_two, g_strdup ("C"));
+	symbol_db_engine_add_new_files (dbe_two, "project_two", files_array_two, languages_two, TRUE);
+	
+	
 	/* 
 	** Message: elapsed: 319.713238 for (4008) [0.079769 per symbol]
 	
@@ -387,8 +409,8 @@
 //	g_message ("getting scope members");
 //	get_scope_members (dbe);
 	
-	g_message ("getting get_global_members");
-	get_global_members (dbe);
+//	g_message ("getting get_global_members");
+//	get_global_members (dbe);
 
 //	g_message ("getting parents");
 //	get_parents (dbe);
@@ -403,11 +425,11 @@
 //	update_buffers (dbe);
 	
 	g_message ("go on with main loop");
+
 	GMainLoop *main_loop;	
 	main_loop = g_main_loop_new( NULL, FALSE );
 	
 	g_main_loop_run( main_loop );
-
 	return 0;
 }
 #endif
@@ -457,7 +479,7 @@
 }
 #endif
 
-#if 1
+#if 0
 
 #include <libgda/libgda.h>
 #include <stdio.h>
@@ -521,9 +543,182 @@
 
 	return 0;
 }
+#endif
+
+#if 0
+#include "pkg.h"
+#include "parse.h"
 
+static void
+packages_foreach (gpointer key, gpointer value, gpointer data)
+{
+	g_message ("--------------------------------------");
+	g_message ("key : %s, value : %s", key, value );
+	
+///*	
+	Package *pkg = parse_package_file (value, TRUE, TRUE);
+	
+	if (pkg == NULL)
+	{
+		g_message ("pkg is NULL.");
+		return;
+	}
+	
+	gchar *output = package_get_I_cflags (pkg);
+	g_message ("I flags: %s", output);
+	//*/
+}
 
+int main(int argc, char** argv)
+{
+  	g_thread_init(NULL);
+  	gtk_init (&argc, &argv);
+	gchar *search_path;
+  
+	GSList *packages;
+	
+  	search_path = getenv ("PKG_CONFIG_PATH");
+  	if (search_path) 
+    {
+      add_search_dirs(search_path, G_SEARCHPATH_SEPARATOR_S);
+    }
+	
+	g_message ("got search path %s", search_path);
+	
+  	if (getenv("PKG_CONFIG_LIBDIR") != NULL) 
+    {
+      add_search_dirs(getenv("PKG_CONFIG_LIBDIR"), G_SEARCHPATH_SEPARATOR_S);
+    }
+	
+	
+	disable_uninstalled = TRUE;
+	enable_private_libs();
+	
+	package_init  ();	
+	
+//	print_package_list ();	
 
 
+	GHashTable *locations = get_packages_locations ();
+	if (locations == NULL)
+	{
+		g_message ("locations is NULL");
+	}
+	g_hash_table_foreach (locations, packages_foreach, NULL);
+	
+	/*
+	Package *pkg = parse_package_file ("/usr/lib/pkgconfig/glib-2.0.pc", TRUE, TRUE);
+	
+	g_message ("got %s", pkg->name);
+	
+	gchar *output = package_get_I_cflags (pkg);
+	g_message ("Got this %s", output);
+	*/
+	
+	/*/
+	packages = parse_module_list (NULL, "glib-2.0", "(command line arguments)");
+	
+	g_message ("==> %d", g_slist_length (packages));
+		
+	if (packages == NULL)
+	{
+		g_message ("packages is NULL!");
+		return -1;
+	}
+
+	output = packages_get_I_cflags (packages);
+	g_message ("Got this %s", output);
+	//*/
+	
+  	gtk_main();
+	
+	return 0;
+}
 #endif
 
+
+#if 0
+#include <libgnomevfs/gnome-vfs.h>
+
+
+GList **
+files_visit_dir (GList **files_list, const gchar* uri)
+{
+	
+	GList *files_in_curr_dir = NULL;
+	
+	if (gnome_vfs_directory_list_load (&files_in_curr_dir, uri,
+								   GNOME_VFS_FILE_INFO_GET_MIME_TYPE) == GNOME_VFS_OK) 
+	{
+		GList *node;
+		node = files_in_curr_dir;
+		do {
+			GnomeVFSFileInfo* info;
+						
+			info = node->data;
+			
+			if (info->type == GNOME_VFS_FILE_TYPE_DIRECTORY) {
+				
+				if (strcmp (info->name, ".") == 0 ||
+					strcmp (info->name, "..") == 0)
+					continue;
+
+				g_message ("node [DIRECTORY]: %s", info->name);				
+				gchar *tmp = g_strdup_printf ("%s/%s", uri, info->name);
+				
+				g_message ("recursing for: %s", tmp);
+				/* recurse */
+				files_list = files_visit_dir (files_list, tmp);
+				
+				g_free (tmp);
+			}
+			else {
+				gchar *local_path;
+				gchar *tmp = g_strdup_printf ("%s/%s", 
+									uri, info->name);
+			
+				g_message ("prepending %s", tmp);
+				local_path = gnome_vfs_get_local_path_from_uri (tmp);
+				*files_list = g_list_append (*files_list, local_path );
+				g_free (tmp);
+			}
+		} while ((node = node->next) != NULL);		
+	}	 
+	
+	return files_list;
+}
+
+
+
+
+int main(int argc, char** argv)
+{
+  	g_thread_init(NULL);
+  	gtk_init (&argc, &argv);
+	GList *files = NULL;
+	GList *node;
+
+	gnome_vfs_init  ();
+	
+	files_visit_dir (&files, "file:///usr/include/glib-2.0");
+
+	if (files == NULL) 
+	{
+		g_message ("files null");
+		return -1;
+	}
+	
+	node = files;
+	
+	do {
+		g_message ("node: %s", node->data);
+	} while ((node = node->next) != NULL);		
+	
+
+  	gtk_main();
+	
+	return 0;  
+}
+#endif
+
+



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