anjuta r4186 - in trunk: . plugins/symbol-browser plugins/symbol-db



Author: jhs
Date: Tue Aug 26 11:28:51 2008
New Revision: 4186
URL: http://svn.gnome.org/viewvc/anjuta?rev=4186&view=rev

Log:
2008-08-23  Massimo Cora\'  <maxcvs email it>

	* plugins/symbol-browser/plugin.c (on_editor_destroy),
	(deactivate_plugin):
	fix #522032

	* plugins/symbol-db/anjuta-symbol-db.glade:
	added two checkboxes: one is for parallel scan control, the other is for
	the buffer updating control.

	* plugins/symbol-db/plugin.c
	(on_editor_buffer_symbols_update_timeout), (on_editor_destroy),
	(on_editor_update_ui), (on_char_added), (on_editor_saved),
	(value_added_current_editor), (on_session_load),
	(value_removed_current_editor), (on_importing_project_end),
	(do_import_system_src_after_abort),
	(do_import_project_src_after_abort), (do_import_project_sources),
	(on_received_project_import_end), (on_project_root_added),
	(on_project_root_removed), (symbol_db_activate),
	(symbol_db_deactivate), (symbol_db_class_init),
	(on_prefs_buffer_update_toggled), (ipreferences_merge):
	* plugins/symbol-db/plugin.h:
	* plugins/symbol-db/symbol-db-engine-iterator-node.c:
	* plugins/symbol-db/symbol-db-engine-iterator-node.h:
	* plugins/symbol-db/symbol-db-engine-iterator.c:
	* plugins/symbol-db/symbol-db-engine-iterator.h:
	* plugins/symbol-db/symbol-db-engine.c
	(sdb_engine_populate_db_by_tags), (sdb_engine_ctags_output_thread),
	(sdb_engine_thread_monitor), (sdb_engine_ctags_output_callback_1),
	(on_scan_files_end_1), (sdb_engine_init),
	(sdb_engine_unref_removed_launchers),
	(sdb_engine_terminate_threads), (sdb_engine_finalize),
	(symbol_db_engine_set_ctags_path), (symbol_db_engine_close_db):
	* plugins/symbol-db/symbol-db-engine.h:
	fix #548606 now engine exits cleanly even if it\'s in scanning mode.
	It still remains the libgda bug anyway, bug #545979.
	Fixed bug #522032 also for symbol-db.

	* plugins/symbol-db/symbol-db-prefs.c (on_update_button_toggled),
	(sdb_prefs_init1), (sdb_prefs_class_init):
	* plugins/symbol-db/symbol-db-prefs.h:
	* plugins/symbol-db/symbol-db-view-locals.c (sdb_view_locals_init),
	(do_add_root_symbol_to_view), (do_add_child_symbol_to_view),
	(on_scan_end), (on_symbol_removed), (on_symbol_scope_updated),
	(on_symbol_inserted), (symbol_db_view_locals_display_nothing),
	(symbol_db_view_locals_update_list):
	* plugins/symbol-db/symbol-db-view-locals.h:
	* plugins/symbol-db/symbol-db-view-search.c:
	* plugins/symbol-db/symbol-db-view-search.h:
	* plugins/symbol-db/symbol-db-view.c:
	* plugins/symbol-db/symbol-db-view.h:
	headers update.

Modified:
   trunk/ChangeLog
   trunk/plugins/symbol-browser/plugin.c
   trunk/plugins/symbol-db/anjuta-symbol-db.glade
   trunk/plugins/symbol-db/plugin.c
   trunk/plugins/symbol-db/plugin.h
   trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c
   trunk/plugins/symbol-db/symbol-db-engine-iterator-node.h
   trunk/plugins/symbol-db/symbol-db-engine-iterator.c
   trunk/plugins/symbol-db/symbol-db-engine-iterator.h
   trunk/plugins/symbol-db/symbol-db-engine.c
   trunk/plugins/symbol-db/symbol-db-engine.h
   trunk/plugins/symbol-db/symbol-db-prefs.c
   trunk/plugins/symbol-db/symbol-db-prefs.h
   trunk/plugins/symbol-db/symbol-db-view-locals.c
   trunk/plugins/symbol-db/symbol-db-view-locals.h
   trunk/plugins/symbol-db/symbol-db-view-search.c
   trunk/plugins/symbol-db/symbol-db-view-search.h
   trunk/plugins/symbol-db/symbol-db-view.c
   trunk/plugins/symbol-db/symbol-db-view.h

Modified: trunk/plugins/symbol-browser/plugin.c
==============================================================================
--- trunk/plugins/symbol-browser/plugin.c	(original)
+++ trunk/plugins/symbol-browser/plugin.c	Tue Aug 26 11:28:51 2008
@@ -626,6 +626,14 @@
 											   uri);
 	}
 	g_hash_table_remove (sv_plugin->editor_connected, G_OBJECT (editor));
+	
+	/* was it the last file loaded? */
+	if (g_hash_table_size (sv_plugin->editor_connected) <= 0)
+	{
+		DEBUG_PRINT ("displaying nothing...");
+		gtk_tree_view_set_model (GTK_TREE_VIEW (sv_plugin->sl_tree),
+									 NULL);
+	}	
 }
 
 static void
@@ -1022,6 +1030,8 @@
 	SymbolBrowserPlugin *sv_plugin;
 	sv_plugin = ANJUTA_PLUGIN_SYMBOL_BROWSER (plugin);
 	
+	DEBUG_PRINT ("SymbolBrowserPlugin: Dectivating Symbol Manager plugin...");
+	
 	/* Ensure all editor cached info are released */
 	if (sv_plugin->editor_connected)
 	{
@@ -1032,6 +1042,15 @@
 		g_hash_table_destroy (sv_plugin->editor_connected);
 		sv_plugin->editor_connected = NULL;
 	}
+
+	/* clear anjuta_symbol_search side */
+	if (sv_plugin->ss)
+		anjuta_symbol_search_clear(ANJUTA_SYMBOL_SEARCH(sv_plugin->ss));
+
+	/* clear glist's sfiles */
+	if (sv_plugin->sv_tree)
+		anjuta_symbol_view_clear (ANJUTA_SYMBOL_VIEW (sv_plugin->sv_tree));
+	
 	/* Remove watches */
 	anjuta_plugin_remove_watch (plugin, sv_plugin->root_watch_id, FALSE);
 	anjuta_plugin_remove_watch (plugin, sv_plugin->editor_watch_id, TRUE);

Modified: trunk/plugins/symbol-db/anjuta-symbol-db.glade
==============================================================================
--- trunk/plugins/symbol-db/anjuta-symbol-db.glade	(original)
+++ trunk/plugins/symbol-db/anjuta-symbol-db.glade	Tue Aug 26 11:28:51 2008
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.4 on Tue Aug  5 00:24:54 2008 -->
+<!--Generated with glade3 3.4.4 on Wed Aug 20 23:49:57 2008 -->
 <glade-interface>
   <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>
@@ -62,7 +62,7 @@
                           <widget class="GtkCheckButton" id="preferences_toggle:bool:1:1:symboldb.scan_prj_pkgs">
                             <property name="visible">True</property>
                             <property name="can_focus">True</property>
-                            <property name="label" translatable="yes">Automatically scan project's packages</property>
+                            <property name="label" translatable="yes">Automatically scan projetc's packages.</property>
                             <property name="response_id">0</property>
                             <property name="draw_indicator">True</property>
                           </widget>
@@ -72,6 +72,41 @@
                         <property name="position">1</property>
                       </packing>
                     </child>
+                    <child>
+                      <widget class="GtkHBox" id="hbox4">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkCheckButton" id="preferences_toggle:bool:1:1:symboldb.parallel_scan">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">Parallel global/project scan of symbols.</property>
+                            <property name="response_id">0</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkHBox" id="hbox5">
+                        <property name="visible">True</property>
+                        <child>
+                          <widget class="GtkCheckButton" id="preferences_toggle:bool:1:1:symboldb.buffer_update">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="label" translatable="yes">Automatically update symbols without saving file.</property>
+                            <property name="response_id">0</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
+                          </widget>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="position">3</property>
+                      </packing>
+                    </child>
                   </widget>
                 </child>
               </widget>

Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c	(original)
+++ trunk/plugins/symbol-db/plugin.c	Tue Aug 26 11:28:51 2008
@@ -58,9 +58,16 @@
 #define SESSION_KEY			"SystemPackages"
 
 static gpointer parent_class;
-static gboolean need_symbols_update = FALSE;
-static gint timeout_id = 0;
-static GTimer *timer = NULL;
+
+/* signals */
+enum
+{
+	PROJECT_IMPORT_END,
+	GLOBALS_IMPORT_END,
+	LAST_SIGNAL
+};
+
+static unsigned int signals[LAST_SIGNAL] = { 0 };
 
 static void
 register_stock_icons (AnjutaPlugin *plugin)
@@ -97,10 +104,10 @@
 	/* check the timer. If it's elapsed enought time since the last time the user
 	 * typed in something, than proceed with updating, elsewhere don't do nothing 
 	 */
-	if (timer == NULL)
+	if (sdb_plugin->update_timer == NULL)
 		return TRUE;
 	
-	seconds_elapsed = g_timer_elapsed (timer, NULL);
+	seconds_elapsed = g_timer_elapsed (sdb_plugin->update_timer, NULL);
 	
 	/* DEBUG_PRINT ("seconds_elapsed  %f", seconds_elapsed ); */
 	if (seconds_elapsed < TIMEOUT_SECONDS_AFTER_LAST_TIP)
@@ -109,7 +116,7 @@
 		
 	 /* we won't proceed with the updating of the symbols if we didn't type in 
 	 	anything */
-	 if (!need_symbols_update)
+	 if (sdb_plugin->need_symbols_update == FALSE)
 	 	return TRUE;
 	
 	DEBUG_PRINT ("on_editor_buffer_symbols_update_timeout()");
@@ -159,7 +166,7 @@
 	
 	g_free (current_buffer);  
 
-	need_symbols_update = FALSE;
+	sdb_plugin->need_symbols_update = FALSE;
 
 	return TRUE;
 }
@@ -170,43 +177,38 @@
 	const gchar *uri;
 	DEBUG_PRINT ("on_editor_destroy ()");
 	if (!sdb_plugin->editor_connected || !sdb_plugin->dbv_view_tree)
+	{
+		DEBUG_PRINT ("on_editor_destroy (): returning....");
 		return;
+	}
 	
 	uri = g_hash_table_lookup (sdb_plugin->editor_connected, G_OBJECT (editor));
 	g_hash_table_remove (sdb_plugin->editor_connected, G_OBJECT (editor));
+	
+	/* was it the last file loaded? */
+	if (g_hash_table_size (sdb_plugin->editor_connected) <= 0)
+	{
+		DEBUG_PRINT ("displaying nothing...");
+		symbol_db_view_locals_display_nothing (
+				SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals), TRUE);
+	}
 }
 
 static void
 on_editor_update_ui (IAnjutaEditor *editor, SymbolDBPlugin *sdb_plugin) 
 {
-	if (timer == NULL)
-	{
-		/* creates and start a new timer. */
-		timer = g_timer_new ();
-	}
-	else 
-	{
-		g_timer_reset (timer);
-	}
+	g_timer_reset (sdb_plugin->update_timer);
 }
 
 static void
 on_char_added (IAnjutaEditor *editor, IAnjutaIterable *position, gchar ch,
 			   SymbolDBPlugin *sdb_plugin)
 {
-	if (timer == NULL)
-	{
-		/* creates and start a new timer. */
-		timer = g_timer_new ();
-	}
-	else 
-	{
-		g_timer_reset (timer);
-	}
+	g_timer_reset (sdb_plugin->update_timer);
 	
 	/* Update when the user enters a newline */
 	if (ch == '\n')	
-		need_symbols_update = TRUE;
+		sdb_plugin->need_symbols_update = TRUE;
 }
 
 
@@ -215,12 +217,10 @@
 				 SymbolDBPlugin *sdb_plugin)
 {
 	const gchar *old_uri;
-	gboolean tags_update;	
-	/* FIXME: Do this only if automatic tags update is enabled */
-	/* tags_update =
-		anjuta_preferences_get_int (te->preferences, AUTOMATIC_TAGS_UPDATE);
-	*/
-	tags_update = TRUE;
+	gboolean tags_update;
+	
+	tags_update = TRUE;		
+	
 	if (tags_update)
 	{
 		gchar *local_filename = g_file_get_path (file);
@@ -249,8 +249,11 @@
 		g_hash_table_insert (sdb_plugin->editor_connected, editor,
 							 g_strdup (saved_uri));
 
+		/* if we saved it we shouldn't update a second time */
+		sdb_plugin->need_symbols_update = FALSE;			
+			
 		on_editor_update_ui (editor, sdb_plugin);
-		g_free (saved_uri);		
+		g_free (saved_uri);
 	}
 }
 
@@ -259,6 +262,7 @@
 							const GValue *value, gpointer data)
 {
 	gchar *uri;
+	gboolean tags_update;
 	GFile* file;
 	gchar *local_path;
 	GObject *editor;
@@ -267,6 +271,11 @@
 	editor = g_value_get_object (value);	
 	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (plugin);
 	
+	/* we have an editor added, so let locals to display something */
+	symbol_db_view_locals_display_nothing (
+			SYMBOL_DB_VIEW_LOCALS (sdb_plugin->dbv_view_tree_locals), FALSE);
+
+	
 	if (sdb_plugin->session_loading)
 	{
 		DEBUG_PRINT ("session_loading");
@@ -341,10 +350,14 @@
 	g_free (local_path);
 	
 	/* add a default timeout to the updating of buffer symbols */	
-	timeout_id = g_timeout_add (TIMEOUT_INTERVAL_SYMBOLS_UPDATE,
+	tags_update = anjuta_preferences_get_int (sdb_plugin->prefs, BUFFER_AUTOSCAN);
+				
+	if (tags_update)
+		sdb_plugin->buf_update_timeout_id = 
+				g_timeout_add (TIMEOUT_INTERVAL_SYMBOLS_UPDATE,
 								on_editor_buffer_symbols_update_timeout,
 								plugin);
-	need_symbols_update = FALSE;
+	sdb_plugin->need_symbols_update = FALSE;
 }
 
 static void
@@ -374,15 +387,15 @@
 	
 	if (phase == ANJUTA_SESSION_PHASE_START)
 	{
-		DEBUG_PRINT ("SymbolDB: session_loading started. Getting info from %s",
-					 anjuta_session_get_session_directory (session));
-		sdb_plugin->session_loading = TRUE;
-
 		GList *session_packages = anjuta_session_get_string_list (session, 
 														SESSION_SECTION, 
 														SESSION_KEY);
 		
 		GList *to_scan_packages = NULL;
+	
+		DEBUG_PRINT ("SymbolDB: session_loading started. Getting info from %s",
+					 anjuta_session_get_session_directory (session));
+		sdb_plugin->session_loading = TRUE;
 		
 		if (session_packages == NULL)
 		{
@@ -404,19 +417,6 @@
 			to_scan_packages = session_packages;
 		}
 
-		/* system's packages management */				
-		GList *item = to_scan_packages; 
-		while (item != NULL)
-		{
-			/* the function will take care of checking if the package is already 
-		 	 * scanned and present on db 
-		 	 */
-			DEBUG_PRINT ("ianjuta_project_manager_get_packages: package required: %s", 
-					 (gchar*)item->data);
-			symbol_db_system_scan_package (sdb_plugin->sdbs, item->data);
-				
-			item = item->next;
-		}
 		
 		sdb_plugin->session_packages = to_scan_packages;
 		
@@ -632,16 +632,18 @@
 	if (!IANJUTA_IS_EDITOR (data))
 		return;
 	
+	sdb_plugin = (SymbolDBPlugin *) plugin;
+	
 	DEBUG_PRINT ("value_removed_current_editor ()");
 	/* let's remove the timeout for symbols refresh */
-	g_source_remove (timeout_id);
-	need_symbols_update = FALSE;
+	g_source_remove (sdb_plugin->buf_update_timeout_id);
+	sdb_plugin->buf_update_timeout_id = 0;
+	sdb_plugin->need_symbols_update = FALSE;
 	
 	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (plugin);
 	sdb_plugin->current_editor = NULL;
 }
 
-
 static void
 on_project_element_added (IAnjutaProjectManager *pm, const gchar *uri,
 						  SymbolDBPlugin *sdb_plugin)
@@ -866,6 +868,9 @@
 	sdb_plugin->files_count_project_done = 0;
 	sdb_plugin->files_count_project = 0;	
 
+	DEBUG_PRINT ("emitting signals[PROJECT_IMPORT_END]");
+	/* emit signal. */
+	g_signal_emit (sdb_plugin, signals[PROJECT_IMPORT_END], 0);	
 
 	/* ok, enable local symbols view */
 	if (!IANJUTA_IS_EDITOR (sdb_plugin->current_editor))
@@ -897,16 +902,16 @@
 }
 
 static void
-do_import_system_src_after_abort (AnjutaPlugin *plugin, 
+do_import_system_src_after_abort (SymbolDBPlugin *sdb_plugin,
 								  const GPtrArray *sources_array)
 {
-	SymbolDBPlugin *sdb_plugin;
+	AnjutaPlugin *plugin;
 	GPtrArray* languages_array = NULL;
 	GPtrArray *to_scan_array = NULL;
 	IAnjutaLanguage* lang_manager;
 	gint i;
 	
-	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (plugin);			
+	plugin = ANJUTA_PLUGIN (sdb_plugin);
 
 	lang_manager =	anjuta_shell_get_interface (plugin->shell, IAnjutaLanguage, 
 										NULL);
@@ -1035,10 +1040,13 @@
 	
 	g_ptr_array_foreach (to_scan_array, (GFunc)g_free, NULL);
 	g_ptr_array_free (to_scan_array, TRUE);
+	
+	/* signal */
+	g_signal_emit (sdb_plugin, signals[PROJECT_IMPORT_END], 0);
 }
 
 static void
-do_import_sources (AnjutaPlugin *plugin, IAnjutaProjectManager *pm, 
+do_import_project_sources (AnjutaPlugin *plugin, IAnjutaProjectManager *pm, 
 				   const gchar *root_dir)
 {
 	SymbolDBPlugin *sdb_plugin;
@@ -1176,6 +1184,39 @@
 	g_ptr_array_free (languages_array, TRUE);	
 }
 
+static  void
+on_received_project_import_end (SymbolDBPlugin *sdb_plugin, gpointer data)
+{
+	DEBUG_PRINT ("on_received_project_import_end ()");
+	/* system's packages management */				
+	GList *item = sdb_plugin->session_packages; 
+	while (item != NULL)
+	{
+		/* the function will take care of checking if the package is already 
+	 	 * scanned and present on db 
+	 	 */
+		DEBUG_PRINT ("ianjuta_project_manager_get_packages: package required: %s", 
+				 (gchar*)item->data);
+		symbol_db_system_scan_package (sdb_plugin->sdbs, item->data);
+				
+		item = item->next;
+	}
+	
+
+	/* the resume thing */
+	GPtrArray *sys_src_array = NULL;
+	sys_src_array = 
+		symbol_db_engine_get_files_with_zero_symbols (sdb_plugin->sdbe_globals);
+
+	if (sys_src_array != NULL && sys_src_array->len > 0) 
+	{
+		do_import_system_src_after_abort (sdb_plugin, sys_src_array);
+			
+		g_ptr_array_foreach (sys_src_array, (GFunc)g_free, NULL);
+		g_ptr_array_free (sys_src_array, TRUE);
+	}	
+}
+
 /* add a new project */
 static void
 on_project_root_added (AnjutaPlugin *plugin, const gchar *name,
@@ -1187,6 +1228,38 @@
 	
 	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (plugin);
 
+	/*
+	 *   The Globals thing
+	 */
+	
+	/* hide it. Default */
+	/* system tags thing: we'll import after abort even if the preferences says not
+	 * to automatically scan the packages.
+	 */
+	gtk_widget_hide (sdb_plugin->progress_bar_system);
+	
+	/* get preferences about the parallel scan */
+	gboolean parallel_scan = anjuta_preferences_get_int (sdb_plugin->prefs, 
+														 PARALLEL_SCAN); 
+	
+	if (parallel_scan == TRUE)
+	{
+		DEBUG_PRINT ("go with parallel scan");
+		/* we simulate a project-import-end signal received */
+		on_received_project_import_end (sdb_plugin, sdb_plugin);		
+	}
+	else
+	{
+		DEBUG_PRINT ("connect to a project-import-end signal");
+		g_signal_connect (G_OBJECT (sdb_plugin), 
+						"project-import-end", 
+						  G_CALLBACK (on_received_project_import_end), 
+						  sdb_plugin);
+	}
+		
+	/*
+	 *   The Project thing
+	 */
 	pm = anjuta_shell_get_interface (ANJUTA_PLUGIN (sdb_plugin)->shell,
 									 IAnjutaProjectManager, NULL);	
 		
@@ -1221,7 +1294,7 @@
 			if (symbol_db_engine_db_exists (sdb_plugin->sdbe_project, 
 											root_dir) == FALSE)
 			{
-				DEBUG_PRINT ("Symbol-DB: project did not exist");
+				DEBUG_PRINT ("Symbol-DB: project does not exist");
 				needs_sources_scan = TRUE;
 				project_exist = FALSE;
 			}
@@ -1234,7 +1307,9 @@
 			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)
@@ -1249,11 +1324,10 @@
 			if (needs_sources_scan == TRUE)
 			{
 				DEBUG_PRINT ("Symbol-DB: importing sources...");
-				do_import_sources (plugin, pm, root_dir);				
+				do_import_project_sources (plugin, pm, root_dir);
 			}
-			else	/* no import needed. */
-			{								
-				/* we may have aborted the scan of sources ..*/
+			else	/* no import needed. But we may have aborted the scan of sources ..*/
+			{
 				GPtrArray *sources_array = NULL;
 				
 				sources_array = 
@@ -1308,26 +1382,9 @@
 	g_signal_connect (G_OBJECT (pm), "element_added",
 					  G_CALLBACK (on_project_element_added), sdb_plugin);
 	g_signal_connect (G_OBJECT (pm), "element_removed",
-					  G_CALLBACK (on_project_element_removed), sdb_plugin);
-	
-	
-	/* hide it. Default */
-	/* system tags thing: we'll import after abort even if the preferences says not
-	 * to automatically scan the packages.
-	 */
-	gtk_widget_hide (sdb_plugin->progress_bar_system);
+					  G_CALLBACK (on_project_element_removed), sdb_plugin);	
 
-	GPtrArray *sys_src_array = NULL;
-	sys_src_array = 
-		symbol_db_engine_get_files_with_zero_symbols (sdb_plugin->sdbe_globals);
-
-	if (sys_src_array != NULL && sys_src_array->len > 0) 
-	{
-		do_import_system_src_after_abort (plugin, sys_src_array);
-				
-		g_ptr_array_foreach (sys_src_array, (GFunc)g_free, NULL);
-		g_ptr_array_free (sys_src_array, TRUE);
-	}	
+	
 }
 
 static void
@@ -1362,6 +1419,9 @@
 	
 	/* don't forget to close the project */
 	symbol_db_engine_close_db (sdb_plugin->sdbe_project);
+	
+	/* and the globals one */
+	symbol_db_engine_close_db (sdb_plugin->sdbe_globals);
 
 	g_free (sdb_plugin->project_root_uri);
 	g_free (sdb_plugin->project_root_dir);
@@ -1404,6 +1464,12 @@
 	 */
 	symbol_db->session_packages = NULL;
 	
+	symbol_db->buf_update_timeout_id = 0;
+	symbol_db->need_symbols_update = FALSE;
+	/* creates and start a new timer. */
+	symbol_db->update_timer = g_timer_new ();
+
+	
 	DEBUG_PRINT ("SymbolDBPlugin: Initializing engines with %s", ctags_path);
 	/* create SymbolDBEngine(s) */
 	symbol_db->sdbe_project = symbol_db_engine_new (ctags_path);
@@ -1631,6 +1697,12 @@
 	g_signal_handlers_disconnect_by_func (G_OBJECT (sdb_plugin->sdbs),										  
 										  on_system_single_file_scan_end,
 										  plugin);
+	
+	if (sdb_plugin->update_timer)
+	{
+		g_timer_destroy (sdb_plugin->update_timer);
+		sdb_plugin->update_timer = NULL;
+	}
 
 	/* destroy objects */
 	if (sdb_plugin->sdbe_project)
@@ -1724,12 +1796,29 @@
 {
 	AnjutaPluginClass *plugin_class = ANJUTA_PLUGIN_CLASS (klass);
 
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
 	parent_class = g_type_class_peek_parent (klass);
 
 	plugin_class->activate = symbol_db_activate;
 	plugin_class->deactivate = symbol_db_deactivate;
 	klass->finalize = symbol_db_finalize;
 	klass->dispose = symbol_db_dispose;
+	
+	signals[PROJECT_IMPORT_END]
+		= g_signal_new ("project-import-end",
+						G_OBJECT_CLASS_TYPE (object_class),
+						G_SIGNAL_RUN_FIRST,
+						G_STRUCT_OFFSET (SymbolDBPluginClass, project_import_end),
+						NULL, NULL,
+						g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
+	
+	signals[GLOBALS_IMPORT_END]
+		= g_signal_new ("globals-import-end",
+						G_OBJECT_CLASS_TYPE (object_class),
+						G_SIGNAL_RUN_FIRST,
+						G_STRUCT_OFFSET (SymbolDBPluginClass, globals_import_end),
+						NULL, NULL,
+						g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);	
 }
 
 static IAnjutaIterable*
@@ -2030,6 +2119,33 @@
 }
 
 static void
+on_prefs_buffer_update_toggled (SymbolDBPrefs *sdbp, guint value, 
+							  gpointer user_data)
+{
+	SymbolDBPlugin *sdb_plugin;
+	DEBUG_PRINT ("on_prefs_buffer_update_toggled () %d", value);
+	
+	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (user_data);
+	
+	if (value == FALSE)
+	{
+		if (sdb_plugin->buf_update_timeout_id)
+			g_source_remove (sdb_plugin->buf_update_timeout_id);
+		sdb_plugin->buf_update_timeout_id = 0;	
+	}
+	else 
+	{
+		if (sdb_plugin->buf_update_timeout_id == 0)
+			sdb_plugin->buf_update_timeout_id = 
+				g_timeout_add (TIMEOUT_INTERVAL_SYMBOLS_UPDATE,
+								on_editor_buffer_symbols_update_timeout,
+								sdb_plugin);			
+		
+	}
+	
+}
+
+static void
 ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError** e)
 {
 	DEBUG_PRINT ("SymbolDB: ipreferences_merge");	
@@ -2052,6 +2168,9 @@
 		g_signal_connect (G_OBJECT (sdb_plugin->sdbp), "package-remove",
 						  G_CALLBACK (on_prefs_package_remove),
 						  sdb_plugin);		
+		g_signal_connect (G_OBJECT (sdb_plugin->sdbp), "buffer-update-toggled",
+						  G_CALLBACK (on_prefs_buffer_update_toggled),
+						  sdb_plugin);				
 	}
 }
 

Modified: trunk/plugins/symbol-db/plugin.h
==============================================================================
--- trunk/plugins/symbol-db/plugin.h	(original)
+++ trunk/plugins/symbol-db/plugin.h	Tue Aug 26 11:28:51 2008
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * plugin.h
- * Copyright (C) Massimo Cora' 2007 <maxcvs email it>
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
  * 
  * plugin.h is free software.
  * 
@@ -61,6 +61,9 @@
 	guint root_watch_id;
 	 
 	/* editor monitor */
+	guint buf_update_timeout_id;
+	gboolean need_symbols_update;
+	GTimer *update_timer;
 	guint editor_watch_id;
 	gchar *project_root_uri;
 	gchar *project_root_dir;
@@ -87,7 +90,7 @@
 	GtkWidget *progress_bar_project;		/* symbol db progress bar - project */
 	GtkWidget *progress_bar_system;			/* symbol db progress bar - system (globals) */
 	
-	GtkWidget *dbv_view_tree;        		/* symbol_db_view */
+	GtkWidget *dbv_view_tree;        		/* symbol_db_view globals */
 	GtkWidget *dbv_view_tab_label;
 	
 	GtkWidget *dbv_view_tree_locals;		/* local symbols */
@@ -116,6 +119,11 @@
 
 struct _SymbolDBPluginClass{
 	AnjutaPluginClass parent_class;
+	
+	/* signals */
+	void (* project_import_end) 	();
+	void (* globals_import_end) 	();
+	
 };
 
 

Modified: trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c	Tue Aug 26 11:28:51 2008
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * anjuta
- * Copyright (C) Massimo Cora' 2007 <maxcvs email it>
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
  * 
  * anjuta is free software.
  * 

Modified: trunk/plugins/symbol-db/symbol-db-engine-iterator-node.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-iterator-node.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-iterator-node.h	Tue Aug 26 11:28:51 2008
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * anjuta
- * Copyright (C) Massimo Cora' 2007 <maxcvs email it>
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
  * 
  * anjuta is free software.
  * 

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	Tue Aug 26 11:28:51 2008
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * anjuta
- * Copyright (C) Massimo Cora' 2007 <maxcvs email it>
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
  * 
  * anjuta is free software.
  * 

Modified: trunk/plugins/symbol-db/symbol-db-engine-iterator.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-iterator.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine-iterator.h	Tue Aug 26 11:28:51 2008
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * anjuta
- * Copyright (C) Massimo Cora' 2007 <maxcvs email it>
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
  * 
  * anjuta is free software.
  * 

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	Tue Aug 26 11:28:51 2008
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * anjuta
- * Copyright (C) Massimo Cora' 2007 <maxcvs email it>
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
  * 
  * anjuta is free software.
  * 
@@ -280,6 +280,7 @@
 typedef void (SymbolDBEngineCallback) (SymbolDBEngine * dbe,
 									   gpointer user_data);
 
+/* signals */
 enum
 {
 	SINGLE_FILE_SCAN_END,
@@ -311,7 +312,11 @@
 	FILE *shared_mem_file;
 	gint shared_mem_fd;
 	AnjutaLauncher *ctags_launcher;
+	GList *removed_launchers;
 	gboolean scanning_status;
+	gboolean shutting_down;
+	GMutex *shutting_mutex;
+	GCond *shutting_cond;
 	
 	GMutex* mutex;
 	GAsyncQueue* signals_queue;
@@ -1243,6 +1248,7 @@
 		g_timer_reset (sym_timer_DEBUG);
 	gint tags_total_DEBUG = 0;
 	tag_entry.file = NULL;
+
 	while (tagsNext (tag_file, &tag_entry) != TagFailure)
 	{
 		gint file_defined_id = 0;
@@ -1469,11 +1475,14 @@
 	}
 
 	priv->thread_status = FALSE;
-	priv->concurrent_threads--;
+	priv->concurrent_threads--;	
 	
 	/* unlock */
 	if (priv->mutex)
 		g_mutex_unlock (priv->mutex);
+
+	/* notify waiters that we've finished another thread */
+	g_cond_signal (priv->shutting_cond);
 	
 	g_free (chars);
 	g_free (output);
@@ -1569,9 +1578,24 @@
 	g_return_val_if_fail (data != NULL, FALSE);
 	
 	priv = dbe->priv;
+	
+	if (priv->shutting_mutex)
+		g_mutex_lock (priv->shutting_mutex);
+	
+	if (priv->shutting_down == TRUE)
+	{
+		DEBUG_PRINT ("SymbolDBEngine is shutting down: removing thread monitor");
+		/* remove the thread monitor */
+		g_source_remove (priv->thread_monitor_handler);
+		priv->thread_monitor_handler = 0;
+		g_mutex_unlock (priv->shutting_mutex);
+		return FALSE;
+	}
 		
-	if (priv->concurrent_threads > THREADS_MAX_CONCURRENT) {
+	if (priv->concurrent_threads > THREADS_MAX_CONCURRENT) 
+	{
 		/* monitor acted here. There are plenty threads already working. */
+		g_mutex_unlock (priv->shutting_mutex);
 		return TRUE;
 	}
 	
@@ -1596,9 +1620,11 @@
 		/* remove the thread monitor */
 		g_source_remove (priv->thread_monitor_handler);
 		priv->thread_monitor_handler = 0;
+		g_mutex_unlock (priv->shutting_mutex);
 		return FALSE;
 	}
 	
+	g_mutex_unlock (priv->shutting_mutex);
 	/* recall this monitor */
 	return TRUE;	
 }
@@ -1616,6 +1642,9 @@
 	
 	priv = dbe->priv;	
 	
+	if (priv->shutting_down == TRUE)
+		return;
+	
 	output  = g_new0 (ThreadDataOutput, 1);
 	output->chars = g_strdup (chars);
 	output->user_data = user_data;
@@ -1652,7 +1681,7 @@
 				   int exit_status, gulong time_taken_in_seconds,
 				   gpointer data)
 {
-	DEBUG_PRINT ("ctags ended");
+	DEBUG_PRINT ("***** ctags ended *****");
 }
 
 
@@ -1916,6 +1945,10 @@
 													  g_free, NULL);	
 	
 	sdbe->priv->ctags_launcher = NULL;
+	sdbe->priv->removed_launchers = NULL;
+	sdbe->priv->shutting_down = FALSE;
+	sdbe->priv->shutting_mutex = g_mutex_new ();
+	sdbe->priv->shutting_cond = g_cond_new ();
 
 	/* set the ctags executable path to NULL */
 	sdbe->priv->ctags_path = NULL;
@@ -2308,6 +2341,33 @@
 	shm_unlink (key);
 }
 
+static void 
+sdb_engine_unref_removed_launchers (gpointer data, gpointer user_data)
+{
+	g_object_unref (data);
+}
+
+static void
+sdb_engine_terminate_threads (SymbolDBEngine *dbe)
+{
+	SymbolDBEnginePriv *priv;	
+	
+	priv = dbe->priv;
+	
+	priv->shutting_down = TRUE;
+
+	/* get a lock to share with the monitor */
+	g_mutex_lock (priv->shutting_mutex);	
+	
+	while (priv->concurrent_threads > 0)
+	{		
+		/* wait for the thread to notify us that it has just finished its execution */
+		g_cond_wait (priv->shutting_cond, priv->shutting_mutex);
+	}	
+	
+	g_mutex_unlock (priv->shutting_mutex);
+}
+
 static void
 sdb_engine_finalize (GObject * object)
 {
@@ -2316,22 +2376,29 @@
 	
 	dbe = SYMBOL_DB_ENGINE (object);
 	priv = dbe->priv;
-
+	
+	/* we're shutting down the plugin. Let the threads finish their work... */
+	sdb_engine_terminate_threads (dbe);
+	
 	if (priv->ctags_launcher)
-	{		
-		anjuta_launcher_signal (priv->ctags_launcher, SIGINT);
+	{
 		g_object_unref (priv->ctags_launcher);
 		priv->ctags_launcher = NULL;
-	}	
+	}		
+	
+	if (priv->removed_launchers)
+	{
+		g_list_foreach (priv->removed_launchers, 
+						sdb_engine_unref_removed_launchers, NULL);
+		g_list_free (priv->removed_launchers);
+		priv->removed_launchers = NULL;
+	}
 	
 	if (priv->mutex)
 	{
-		while (priv->concurrent_threads > 0)
-			;
 		g_mutex_free (priv->mutex);
 		priv->mutex = NULL;
 	}
-
 	
 	if (priv->timeout_trigger_handler > 0)
 		g_source_remove (priv->timeout_trigger_handler);
@@ -2402,6 +2469,9 @@
 	sdb_engine_clear_caches (dbe);
 
 	g_tree_destroy (priv->file_symbols_cache);
+
+	g_mutex_free (priv->shutting_mutex);
+	priv->shutting_mutex = NULL;	
 	
 	g_free (priv);
 	
@@ -2518,6 +2588,11 @@
 				   "the old value %s", priv->ctags_path);
 		return;
 	}	
+	
+	/* have we already got it? */
+	if (priv->ctags_path != NULL && 
+		strcmp (priv->ctags_path, ctags_path) == 0)
+		return;
 
 	/* free the old value */
 	g_free (priv->ctags_path);
@@ -2525,13 +2600,14 @@
 	/* is anjutalauncher already created? */
 	if (priv->ctags_launcher != NULL)
 	{
-		anjuta_launcher_reset (priv->ctags_launcher);
-		anjuta_launcher_signal (priv->ctags_launcher, SIGINT);
-		g_object_unref (priv->ctags_launcher);
-		priv->ctags_launcher = NULL;
+		AnjutaLauncher *tmp;
+		tmp = priv->ctags_launcher;
 
 		/* recreate it on the fly */
 		sdb_engine_ctags_launcher_create (dbe);
+
+		/* keep the launcher alive to avoid crashes */
+		priv->removed_launchers = g_list_prepend (priv->removed_launchers, tmp);
 	}	
 	
 	/* set the new one */
@@ -2743,6 +2819,10 @@
 	g_return_val_if_fail (dbe != NULL, FALSE);
 	
 	priv = dbe->priv;
+	
+	/* terminate threads, if ever they're running... */
+	sdb_engine_terminate_threads (dbe);
+	
 	return sdb_engine_disconnect_from_db (dbe);
 }
 

Modified: trunk/plugins/symbol-db/symbol-db-engine.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine.h	Tue Aug 26 11:28:51 2008
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * anjuta
- * Copyright (C) Massimo Cora' 2007 <maxcvs email it>
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
  * 
  * anjuta is free software.
  * 

Modified: trunk/plugins/symbol-db/symbol-db-prefs.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-prefs.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-prefs.c	Tue Aug 26 11:28:51 2008
@@ -48,6 +48,7 @@
 {
 	PACKAGE_ADD,
 	PACKAGE_REMOVE,
+	BUFFER_UPDATE_TOGGLED,
 	LAST_SIGNAL
 };
 
@@ -373,11 +374,28 @@
 }
 
 static void
+on_update_button_toggled (GtkToggleButton *togglebutton, SymbolDBPrefs *sdbp)
+{
+	SymbolDBPrefsPriv *priv;	
+	gboolean update_button_value;
+	priv = sdbp->priv;
+	GtkWidget *update_button;
+	
+	update_button = glade_xml_get_widget (priv->prefs_gxml, BUFFER_AUTOSCAN);
+
+	update_button_value =  gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (update_button));
+	DEBUG_PRINT ("on_update_button_toggled ()");
+	anjuta_preferences_set_int (priv->prefs, BUFFER_AUTOSCAN, update_button_value);	
+
+	g_signal_emit (sdbp, signals[BUFFER_UPDATE_TOGGLED], 0, update_button_value);
+}
+
+static void
 sdb_prefs_init1 (SymbolDBPrefs *sdbp)
 {
 	SymbolDBPrefsPriv *priv;
 	GtkWidget *fchooser;
-	GtkWidget *check_button;
+	GtkWidget *check_button, *update_button;
 	gboolean check_button_value;
 	gchar *ctags_value;
 
@@ -419,6 +437,11 @@
 					  G_CALLBACK (on_check_button_toggled), sdbp);
 	check_button_value = anjuta_preferences_get_int (priv->prefs, PROJECT_AUTOSCAN);
 	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), check_button_value);
+
+	update_button = glade_xml_get_widget (priv->prefs_gxml, BUFFER_AUTOSCAN);
+	g_signal_connect (G_OBJECT (update_button), "toggled", 
+					  G_CALLBACK (on_update_button_toggled), sdbp);	
+	
 	
 	g_free (ctags_value);
 }
@@ -575,6 +598,16 @@
 						1,
 						G_TYPE_STRING);	
 	
+	signals[BUFFER_UPDATE_TOGGLED]
+		= g_signal_new ("buffer-update-toggled",
+						G_OBJECT_CLASS_TYPE (object_class),
+						G_SIGNAL_RUN_FIRST,
+						G_STRUCT_OFFSET (SymbolDBPrefsClass, buffer_update_toggled),
+						NULL, NULL,
+						g_cclosure_marshal_VOID__UINT, G_TYPE_NONE, 
+						1,
+						G_TYPE_UINT);	
+	
 	object_class->finalize = sdb_prefs_finalize;
 }
 

Modified: trunk/plugins/symbol-db/symbol-db-prefs.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-prefs.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-prefs.h	Tue Aug 26 11:28:51 2008
@@ -42,16 +42,17 @@
 
 #define CTAGS_PREFS_KEY		"preferences_file:text:/usr/bin/ctags:0:symboldb.ctags"
 #define PROJECT_AUTOSCAN	"preferences_toggle:bool:1:1:symboldb.scan_prj_pkgs"
-
+#define PARALLEL_SCAN		"preferences_toggle:bool:1:1:symboldb.parallel_scan"
+#define BUFFER_AUTOSCAN		"preferences_toggle:bool:1:1:symboldb.buffer_update"
 
 struct _SymbolDBPrefsClass
 {
 	GObjectClass parent_class;
 	
 	/* signals */
-	void (* package_add) 		(const gchar *package);
-	void (* package_remove)		(const gchar *package);
-	
+	void (* package_add) 			(const gchar *package);
+	void (* package_remove)			(const gchar *package);
+	void (* buffer_update_toggled)	(guint value);
 };
 
 struct _SymbolDBPrefs

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	Tue Aug 26 11:28:51 2008
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * anjuta
- * Copyright (C) Massimo Cora' 2007 <maxcvs email it>
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
  * 
  * anjuta is free software.
  * 
@@ -78,6 +78,7 @@
 	GTree *waiting_for;	
 	GQueue *symbols_inserted_ids;
 
+	gboolean display_nothing;
 	gboolean recv_signals;
 	GHashTable *files_view_status;
 };
@@ -272,8 +273,8 @@
 	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);
-
 	priv->recv_signals = FALSE;
+	priv->display_nothing = FALSE;
 
 	/* initially set it to NULL */
 	store = NULL;
@@ -389,7 +390,10 @@
 	priv = dbvl->priv;	
 	
 	store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));
- 	
+
+	if (store == NULL)
+		return NULL;
+	
 	gtk_tree_store_append (store, &child_iter, NULL);			
 	gtk_tree_store_set (store, &child_iter,
 		COLUMN_PIXBUF, pixbuf,
@@ -423,6 +427,9 @@
 	
 	store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));
 
+	if (store == NULL)
+		return NULL;
+	
 	/* look up the row ref in the hashtable, then get its associated gtktreeiter */
 	row_ref = g_tree_lookup (priv->nodes_displayed, (gpointer)parent_symbol_id);
 	
@@ -1002,6 +1009,11 @@
 	g_return_if_fail (dbvl != NULL);
 	priv = dbvl->priv;
 
+	if (priv->display_nothing)
+	{
+		return;
+	}
+	
 	tdata = g_new (TraverseData, 1);
 	tdata->dbvl = dbvl;
 	tdata->dbe = dbe;
@@ -1067,7 +1079,6 @@
 static void 
 on_symbol_removed (SymbolDBEngine *dbe, gint symbol_id, gpointer data)
 {
-	GtkTreeStore *store;
 	SymbolDBViewLocals *dbvl;
 	SymbolDBViewLocalsPriv *priv;
     GtkTreeIter  iter;	
@@ -1078,8 +1089,11 @@
 	g_return_if_fail (dbvl != NULL);
 	priv = dbvl->priv;
 
-	store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));		
-
+	if (priv->display_nothing)
+	{
+		return;
+	}
+	
 	DEBUG_PRINT ("on_symbol_removed (): -local- %d", symbol_id);
 
 	row_ref = g_tree_lookup (priv->nodes_displayed, (gpointer)symbol_id);
@@ -1094,7 +1108,6 @@
 static void
 on_symbol_scope_updated (SymbolDBEngine *dbe, gint symbol_id, gpointer data)
 {
-	GtkTreeStore *store;
 	SymbolDBViewLocals *dbvl;
 	SymbolDBViewLocalsPriv *priv;
     GtkTreeIter  iter;	
@@ -1105,20 +1118,22 @@
 	g_return_if_fail (dbvl != NULL);
 	priv = dbvl->priv;
 
-	store = GTK_TREE_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (dbvl)));		
-
+	if (priv->display_nothing)
+	{
+		return;
+	}
+	
 	DEBUG_PRINT ("on_symbol_scope_updated () -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;
 	}
-#if 1
+
 	do_recurse_subtree_and_remove (dbvl, &iter);	
 	
 	/* save the symbol_id to be added in the queue and just return */
 	g_queue_push_head (priv->symbols_inserted_ids, (gpointer)symbol_id);	
-#endif	
 }
 
 static void 
@@ -1131,6 +1146,11 @@
 
 	g_return_if_fail (dbvl != NULL);	
 	priv = dbvl->priv;	
+
+	if (priv->display_nothing)
+	{
+		return;
+	}
 	
 	/* save the symbol_id to be added in the queue and just return */
 	g_queue_push_head (priv->symbols_inserted_ids, (gpointer)symbol_id);
@@ -1245,6 +1265,28 @@
 }
 
 void
+symbol_db_view_locals_display_nothing (SymbolDBViewLocals *dbvl, 
+									   gboolean display_nothing)
+{
+	SymbolDBViewLocalsPriv *priv;
+	
+	g_return_if_fail (dbvl != NULL);
+	
+	priv = dbvl->priv;
+	
+	if (display_nothing == TRUE)
+	{
+		priv->display_nothing = TRUE;
+	
+		gtk_tree_view_set_model (GTK_TREE_VIEW (dbvl), NULL);	
+	}
+	else 
+	{
+		priv->display_nothing = FALSE;
+	}
+}
+
+void
 symbol_db_view_locals_update_list (SymbolDBViewLocals *dbvl, SymbolDBEngine *dbe,
 							  const gchar* filepath)
 {
@@ -1260,6 +1302,8 @@
 
 	priv = dbvl->priv;
 
+	DEBUG_PRINT ("symbol_db_view_locals_update_list () %s", filepath);
+	
 	/* we're not interested in giving user an updated gtktreestore if recv signals
 	 * is false. In that case we can have a project importing...
 	 */
@@ -1399,9 +1443,10 @@
 		
 		/* Removes all rows from tree_store */
 		gtk_tree_store_clear (store);
-		iterator = symbol_db_engine_get_file_symbols (dbe, filepath, SYMINFO_SIMPLE |
-												  	SYMINFO_ACCESS |
-													SYMINFO_KIND);		
+		iterator = symbol_db_engine_get_file_symbols (dbe, filepath, 
+													  	SYMINFO_SIMPLE |
+												  		SYMINFO_ACCESS |
+														SYMINFO_KIND);		
 	 	
 		if (iterator != NULL)
 		{

Modified: trunk/plugins/symbol-db/symbol-db-view-locals.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view-locals.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-view-locals.h	Tue Aug 26 11:28:51 2008
@@ -83,6 +83,13 @@
 void 
 symbol_db_view_locals_clear_cache (SymbolDBViewLocals *dbvl);
 
+/**
+ * Display no items in local-tree
+ **/
+void
+symbol_db_view_locals_display_nothing (SymbolDBViewLocals *dbvl, 
+									   gboolean display_nothing);
+
 G_END_DECLS
 
 #endif /* _SYMBOL_DB_VIEW_LOCALS_H_ */

Modified: trunk/plugins/symbol-db/symbol-db-view-search.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view-search.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-view-search.c	Tue Aug 26 11:28:51 2008
@@ -3,7 +3,7 @@
  * anjuta
  * Copyright (C) 2001-2003 CodeFactory AB
  * Copyright (C) 2001-2003 Mikael Hallendal <micke imendio com>
- * Copyright (C) 2005-2007 Massimo Corà <maxcvs email it>
+ * Copyright (C) 2005-2008 Massimo Corà <maxcvs email it>
  * 
  * anjuta is free software.
  * 

Modified: trunk/plugins/symbol-db/symbol-db-view-search.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view-search.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-view-search.h	Tue Aug 26 11:28:51 2008
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * anjuta
- * Copyright (C) Massimo Cora' 2007 <maxcvs email it>
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
  * 
  * anjuta is free software.
  * 

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	Tue Aug 26 11:28:51 2008
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * anjuta
- * Copyright (C) Massimo Cora' 2007 <maxcvs email it>
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
  * 
  * anjuta is free software.
  * 

Modified: trunk/plugins/symbol-db/symbol-db-view.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-view.h	Tue Aug 26 11:28:51 2008
@@ -1,7 +1,7 @@
 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
 /*
  * anjuta
- * Copyright (C) Massimo Cora' 2007 <maxcvs email it>
+ * Copyright (C) Massimo Cora' 2007-2008 <maxcvs email it>
  * 
  * anjuta is free software.
  * 



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