anjuta r3639 - in branches/anjuta-symbol-db: . libanjuta plugins plugins/sourceview plugins/symbol-browser plugins/symbol-db plugins/symbol-db/test



Author: jhs
Date: Mon Feb 11 23:31:06 2008
New Revision: 3639
URL: http://svn.gnome.org/viewvc/anjuta?rev=3639&view=rev

Log:
2008-02-12  Johannes Schmid <jhs gnome org>

	* libanjuta/anjuta-launcher.c: (anjuta_launcher_initialize),
	(anjuta_launcher_dispose), (anjuta_launcher_scan_output),
	(anjuta_launcher_scan_error), (anjuta_launcher_scan_pty),
	(anjuta_launcher_set_encoding), (anjuta_launcher_fork):
	Fixed anjuta_launcher_set_encoding to be able to read binary streams
	
	* plugins/Makefile.am:
	* plugins/sourceview/anjuta-view.c: (anjuta_view_key_press_event):
	* plugins/sourceview/sourceview-cell.c: (icell_get_attribute):
	* plugins/sourceview/sourceview-prefs.c: (init_colors_and_fonts),
	(sourceview_prefs_init):
	* plugins/sourceview/sourceview.c: (sourceview_finalize),
	(mark_real), (imark_unmark), (imark_is_marker_set),
	(imark_delete_all_markers), (ibookmark_toggle), (goto_bookmark),
	(ibookmark_clear_all), (iassist_show_tips):
	Updated from trunk to fix build with new gtksourceview version
	
	* plugins/symbol-db/symbol-db-engine.c:
	Use anjuta_launcher_set_encoding to fix issue with C++ files

2008-02-08  Massimo Cora\'  <maxcvs email it>

	* plugins/symbol-browser/plugin.c:
	(isymbol_manager_get_completions_at_position):
	deprecated.

	* plugins/symbol-db/Makefile.am:
	* plugins/symbol-db/anjuta-symbol-db.glade:
	* plugins/symbol-db/anjuta-symbol-db.schemas:
	* plugins/symbol-db/plugin.c: (do_import_sources_after_abort),
	(do_import_sources), (project_root_added), (symbol_db_activate),
	(on_prefs_executable_changed), (on_gconf_notify_prefs),
	(ipreferences_merge), (ipreferences_unmerge),
	(ipreferences_iface_init):
	* plugins/symbol-db/plugin.h:
	added a preferences page. 

	* plugins/symbol-db/symbol-db-engine.c:
	(sdb_engine_ctags_output_thread), (sdb_engine_scan_files_1),
	(symbol_db_engine_add_new_files),
	(symbol_db_engine_update_project_symbols),
	(symbol_db_engine_get_files_with_zero_symbols),
	(symbol_db_engine_find_symbol_by_name_pattern_filtered):
	* plugins/symbol-db/symbol-db-engine.h:
	added a method to continue population of a project after an abort [e.g. closing
	Anjuta before symbol-db has finished its tasks].
	Fixed also a little bug in output parsing.

	* plugins/symbol-db/symbol-db-view.c: (prepare_for_adding),
	(sdb_view_row_expanded_idle),
	(sdb_view_build_and_display_base_tree):
	removed unuseful debug messages.

	* plugins/symbol-db/symbol-db.ui:
	removed unused file.

	* plugins/symbol-db/test/Makefile.am:
	* plugins/symbol-db/test/main.c: (get_parents), (main):
	* plugins/symbol-db/test/parse.c: (read_one_line), (trim_string),
	(trim_and_sub), (parse_name), (parse_version), (parse_description),
	(split_module_list), (parse_module_list), (parse_requires),
	(parse_requires_private), (parse_conflicts), (_do_parse_libs),
	(parse_libs), (parse_libs_private), (parse_cflags), (parse_url),
	(parse_line), (parse_package_file), (backticks), (try_command),
	(get_compat_package):
	* plugins/symbol-db/test/parse.h:
	* plugins/symbol-db/test/pkg.c: (debug_spew), (verbose_error),
	(add_search_dir), (add_search_dirs), (ends_in_dotpc),
	(name_ends_in_uninstalled), (scan_dir),
	(add_virtual_pkgconfig_package), (package_init), (file_readable),
	(internal_get_package), (get_package), (get_package_quiet),
	(string_list_strip_duplicates),
	(string_list_strip_duplicates_from_back), (string_list_to_string),
	(get_l_libs), (get_L_libs), (get_other_libs), (get_I_cflags),
	(get_other_cflags), (get_conflicts), (get_requires),
	(get_requires_private), (pathposcmp), (spew_package_list),
	(spew_string_list), (packages_sort_by_path_position),
	(fill_one_level), (recursive_fill_list),
	(fill_list_single_package), (fill_list),
	(compare_req_version_names), (compare_package_keys),
	(add_env_variable_to_list), (verify_package), (get_merged),
	(get_merged_from_back), (get_multi_merged),
	(get_multi_merged_from_back), (package_get_l_libs),
	(packages_get_l_libs), (package_get_L_libs), (packages_get_L_libs),
	(package_get_other_libs), (packages_get_other_libs),
	(packages_get_all_libs), (package_get_I_cflags),
	(packages_get_I_cflags), (package_get_other_cflags),
	(packages_get_other_cflags), (package_get_cflags),
	(packages_get_all_cflags), (define_global_variable),
	(package_get_var), (packages_get_var), (rpmvercmp),
	(compare_versions), (version_test), (comparison_to_str),
	(max_len_foreach), (packages_foreach), (print_package_list),
	(enable_private_libs), (disable_private_libs):
	* plugins/symbol-db/test/pkg.h:
	Added some files from pkg-config tools [slackware sources, but should be general].
	Started tests for last part of the plugin: the global tags.

Modified:
   branches/anjuta-symbol-db/ChangeLog
   branches/anjuta-symbol-db/libanjuta/anjuta-launcher.c
   branches/anjuta-symbol-db/plugins/Makefile.am
   branches/anjuta-symbol-db/plugins/sourceview/anjuta-view.c
   branches/anjuta-symbol-db/plugins/sourceview/sourceview-cell.c
   branches/anjuta-symbol-db/plugins/sourceview/sourceview-prefs.c
   branches/anjuta-symbol-db/plugins/sourceview/sourceview.c
   branches/anjuta-symbol-db/plugins/symbol-browser/plugin.c
   branches/anjuta-symbol-db/plugins/symbol-db/Makefile.am
   branches/anjuta-symbol-db/plugins/symbol-db/plugin.c
   branches/anjuta-symbol-db/plugins/symbol-db/plugin.h
   branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.c
   branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.h
   branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-view.c
   branches/anjuta-symbol-db/plugins/symbol-db/symbol-db.ui
   branches/anjuta-symbol-db/plugins/symbol-db/test/Makefile.am
   branches/anjuta-symbol-db/plugins/symbol-db/test/main.c

Modified: branches/anjuta-symbol-db/libanjuta/anjuta-launcher.c
==============================================================================
--- branches/anjuta-symbol-db/libanjuta/anjuta-launcher.c	(original)
+++ branches/anjuta-symbol-db/libanjuta/anjuta-launcher.c	Mon Feb 11 23:31:06 2008
@@ -140,6 +140,10 @@
 	
 	/* Callback data */
 	gpointer callback_data;
+	
+	/* Encondig */
+	gboolean custom_encoding;
+	gchar* encoding;
 };
 
 enum
@@ -208,6 +212,10 @@
 	/* Output callback */
 	obj->priv->output_callback = NULL;
 	obj->priv->callback_data = NULL;
+	
+	/* Encoding */
+	obj->priv->custom_encoding = FALSE;
+	obj->priv->encoding = NULL;
 }
 
 GType
@@ -252,6 +260,9 @@
 		 */
 		kill (child_pid_save, SIGTERM);
 		launcher->priv->busy = FALSE;
+		
+		if (launcher->priv->custom_encoding && launcher->priv->encoding)
+			g_free (launcher->priv->encoding);
 	}
 	GNOME_CALL_PARENT (G_OBJECT_CLASS, dispose, (obj));
 }
@@ -746,7 +757,7 @@
 		do
 		{
 			g_io_channel_read_chars (channel, buffer, FILE_BUFFER_SIZE-1, &n, &err);
-			if (n > 0 && !err) /* There is output */
+			if (n > 0) /* There is output */
 			{
 				gchar *utf8_chars;
 				buffer[n] = '\0';
@@ -757,9 +768,9 @@
 				g_free (utf8_chars);
 			}
 			/* Ignore illegal characters */
-			else if (err && err->domain == G_CONVERT_ERROR)
+			if (err && err->domain == G_CONVERT_ERROR)
 			{
-				DEBUG_PRINT ("stdout: %s", err->message);
+				g_warning ("stdout: %s", err->message);
 				g_error_free (err);
 				err = NULL;
 			}
@@ -767,7 +778,7 @@
 			/* if not related to non blocking read or interrupted syscall */
 			else if (err && errno != EAGAIN && errno != EINTR)
 			{
-				DEBUG_PRINT ("stdout: %s", err->message);
+				g_warning ("stdout: %s", err->message);
 				launcher->priv->stdout_is_done = TRUE;
 				anjuta_launcher_synchronize (launcher);
 				ret = FALSE;
@@ -802,7 +813,7 @@
 		do
 		{
 			g_io_channel_read_chars (channel, buffer, FILE_BUFFER_SIZE-1, &n, &err);
-			if (n > 0 && !err) /* There is stderr output */
+			if (n > 0) /* There is stderr output */
 			{
 				gchar *utf8_chars;
 				buffer[n] = '\0';
@@ -813,9 +824,9 @@
 				g_free (utf8_chars);
 			}
 			/* Ignore illegal characters */
-			else if (err && err->domain == G_CONVERT_ERROR)
+			if (err && err->domain == G_CONVERT_ERROR)
 			{
-				DEBUG_PRINT ("stderr: %s", err->message);
+				g_warning ("stderr: %s", err->message);
 				g_error_free (err);
 				err = NULL;
 			}
@@ -823,7 +834,7 @@
 			/* if not related to non blocking read or interrupted syscall */
 			else if (err && errno != EAGAIN && errno != EINTR)
 			{
-				DEBUG_PRINT ("stderr: %s", err->message);
+				g_warning ("stderr: %s", err->message);
 				
 				launcher->priv->stderr_is_done = TRUE;
 				anjuta_launcher_synchronize (launcher);
@@ -859,7 +870,7 @@
 		do
 		{
 			g_io_channel_read_chars (channel, buffer, FILE_BUFFER_SIZE-1, &n, &err);
-			if (n > 0 && !err) /* There is stderr output */
+			if (n > 0) /* There is stderr output */
 			{
 				gchar *utf8_chars;
 				gchar *old_str = launcher->priv->pty_output_buffer;
@@ -876,9 +887,9 @@
 				g_free (utf8_chars);
 			}
 			/* Ignore illegal characters */
-			else if (err && err->domain == G_CONVERT_ERROR)
+			if (err && err->domain == G_CONVERT_ERROR)
 			{
-				DEBUG_PRINT ("pty: %s", err->message);
+				g_warning ("pty: %s", err->message);
 				g_error_free (err);
 				err = NULL;
 			}
@@ -886,7 +897,7 @@
 			/* if not related to non blocking read or interrupted syscall */
 			else if (err && errno != EAGAIN && errno != EINTR)
 			{
-				DEBUG_PRINT ("pty: %s", err->message);
+				g_warning ("pty: %s", err->message);
 				ret = FALSE;
 			}
 		/* Read next chars if buffer was too small
@@ -1051,6 +1062,12 @@
 	g_return_val_if_fail (launcher != NULL, FALSE);
 	// charset can be NULL
 
+	launcher->priv->custom_encoding = TRUE;
+	if (charset)
+	  launcher->priv->encoding = g_strdup(charset);
+	else
+	  launcher->priv->encoding = NULL;
+		
 	s = g_io_channel_set_encoding (launcher->priv->stderr_channel, charset, NULL);
 	if (s != G_IO_STATUS_NORMAL) r = FALSE;
 	s = g_io_channel_set_encoding (launcher->priv->stdout_channel, charset, NULL);
@@ -1073,7 +1090,6 @@
 	int stdout_pipe[2], stderr_pipe[2];
 	pid_t child_pid;
 	struct termios termios_flags;
-	const gchar *charset;
 	
 	working_dir = g_get_current_dir ();
 	
@@ -1143,11 +1159,11 @@
 	launcher->priv->pty_channel = g_io_channel_unix_new (pty_master_fd);
 
 	g_io_channel_set_buffer_size (launcher->priv->pty_channel, FILE_INPUT_BUFFER_SIZE);
-	
-		
-	g_get_charset (&charset);
-	anjuta_launcher_set_encoding (launcher, charset);
 
+	if (!launcher->priv->custom_encoding)
+	  g_get_charset ((const gchar**)&launcher->priv->encoding);
+	anjuta_launcher_set_encoding (launcher, launcher->priv->encoding);
+	
 	tcgetattr(pty_master_fd, &termios_flags);
 	termios_flags.c_iflag &= ~(IGNPAR | INPCK | INLCR | IGNCR | ICRNL | IXON |
 					IXOFF | ISTRIP);

Modified: branches/anjuta-symbol-db/plugins/Makefile.am
==============================================================================
--- branches/anjuta-symbol-db/plugins/Makefile.am	(original)
+++ branches/anjuta-symbol-db/plugins/Makefile.am	Mon Feb 11 23:31:06 2008
@@ -13,7 +13,6 @@
 	file-wizard \
 	project-wizard \
 	project-manager \
-	symbol-browser \
 	sample1 \
 	cvs-plugin \
 	macro \

Modified: branches/anjuta-symbol-db/plugins/sourceview/anjuta-view.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/sourceview/anjuta-view.c	(original)
+++ branches/anjuta-symbol-db/plugins/sourceview/anjuta-view.c	Mon Feb 11 23:31:06 2008
@@ -764,33 +764,35 @@
 	SourceviewCell* cell;
 	
 	buffer  = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
-
+	
 	assist_win = view->priv->sv->priv->assist_win;
 	assist_tip = view->priv->sv->priv->assist_tip;
 	if (assist_win)
 	{
-	  if (assist_window_filter_keypress(assist_win, event->keyval))
-	  {
+		if (assist_window_filter_keypress(assist_win, event->keyval))
+		{
 			DEBUG_PRINT("key filtered: %d", event->keyval);
 			return TRUE;
-	  }
+		}
 	}
 	
 	switch (event->keyval)
-	 {
+	{
 		case GDK_Shift_L:
 		case GDK_Shift_R:
 		{
 			return TRUE;
 		}
 		default:
-		 {
+		{
 			gboolean retval = (* GTK_WIDGET_CLASS (anjuta_view_parent_class)->key_press_event)(widget, event);
 			gtk_text_buffer_get_iter_at_mark(buffer, &iter, 
-									 gtk_text_buffer_get_insert(buffer));
+											 gtk_text_buffer_get_insert(buffer));
+			/* Iter is at the position after the newly added character... */
+				gtk_text_iter_backward_char (&iter);
 			cell = sourceview_cell_new (&iter, GTK_TEXT_VIEW (view));
 			/* Handle char_added signal here */
-			if (event->keyval == GDK_Return)
+				if (event->keyval == GDK_Return)
 			{
 				g_signal_emit_by_name (G_OBJECT(view), "char_added",
 									   cell, '\n');
@@ -806,26 +808,25 @@
 									  cell, '\0');
 			}
 			else if (event->keyval == GDK_Escape || 
-							 event->keyval == GDK_Up ||
-							 event->keyval == GDK_Down)
+					 event->keyval == GDK_Up ||
+					 event->keyval == GDK_Down)
 			{
 				if (assist_tip)
-        {
+				{
 					gtk_widget_destroy (GTK_WIDGET(assist_tip));
 					g_object_unref (cell);
-          return retval;
-        }
+					return retval;
+				}
 			}
 			else if (event->keyval == GDK_Left || event->keyval == GDK_Right ||
-							 event->keyval == GDK_Up || event->keyval == GDK_Down ||
-							 event->keyval == GDK_Page_Up || event->keyval == GDK_Page_Down ||
-							 event->keyval == GDK_Begin || event->keyval == GDK_End)
+					 event->keyval == GDK_Up || event->keyval == GDK_Down ||
+					 event->keyval == GDK_Page_Up || event->keyval == GDK_Page_Down ||
+					 event->keyval == GDK_Begin || event->keyval == GDK_End)
 			{
 				/* Ignore those for char_added */
 				g_object_unref (cell);
 				return retval;
 			}
-							 
 			else
 			{
 				gchar* unistring = g_new0(gchar, 6);

Modified: branches/anjuta-symbol-db/plugins/sourceview/sourceview-cell.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/sourceview/sourceview-cell.c	(original)
+++ branches/anjuta-symbol-db/plugins/sourceview/sourceview-cell.c	Mon Feb 11 23:31:06 2008
@@ -129,35 +129,6 @@
 {
 	SourceviewCell* cell = SOURCEVIEW_CELL(icell);
 	IAnjutaEditorAttribute attrib = IANJUTA_EDITOR_TEXT;
-	GSList* tags;
-	/* This is a kind of ugly hack. GtkSourceview does not really expose an
-		API to get the type of tag but the id holds the important stuff */
-	/*for (tags = gtk_text_iter_get_tags(cell->priv->iter); tags != NULL; tags = tags->next)
-	{
-		if (GTK_IS_SOURCE_TAG(tags->data))
-		{
-			gchar* id;
-			g_object_get(G_OBJECT(tags->data), "id", &id, NULL);
-			if (g_str_has_prefix(id, "Keyword") || g_str_has_suffix(id, "Keyword"))
-			{
-				attrib = IANJUTA_EDITOR_KEYWORD;
-				break;
-			}
-			if (g_str_has_prefix(id, "Comment") || g_str_has_suffix(id, "Comment"))
-			{
-				attrib = IANJUTA_EDITOR_COMMENT;
-				break;
-			}
-			if (g_str_has_prefix(id, "String") || g_str_has_suffix(id, "String") ||
-					g_str_equal (id, "Character Constant"))
-			{
-				attrib = IANJUTA_EDITOR_STRING;
-				break;
-			}
-			//DEBUG_PRINT("GtkSourceTag tag_style = %s", id);
-		}
-	}
-	g_slist_free(tags);*/
 	return attrib;
 }
 

Modified: branches/anjuta-symbol-db/plugins/sourceview/sourceview-prefs.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/sourceview/sourceview-prefs.c	(original)
+++ branches/anjuta-symbol-db/plugins/sourceview/sourceview-prefs.c	Mon Feb 11 23:31:06 2008
@@ -35,8 +35,8 @@
 #define TAB_SIZE                   "tabsize"
 #define INDENT_SIZE                "indent.size"
 
-#define VIEW_LINENUMBERS           "sourceview.linenumbers.visible"
-#define VIEW_MARKS                 "sourceview.marks.visible"
+#define VIEW_LINENUMBERS           "margin.linenumber.visible"
+#define VIEW_MARKS                 "margin.marker.visible"
 #define VIEW_RIGHTMARGIN           "sourceview.rightmargin.visible"
 #define RIGHTMARGIN_POSITION       "sourceview.rightmargin.position"
 
@@ -299,11 +299,10 @@
 		g_free (desktop_fixed_font);
 		g_object_unref (gclient);
 	}
-	
-	if (!color_theme)
-	{
-		on_gconf_notify_color(NULL, 0, NULL, sv);
-	}
+ 	if (!color_theme)
+  		on_gconf_notify_color (NULL, 0, NULL, sv);
+	else
+		anjuta_view_set_colors(sv->priv->view, TRUE, NULL, NULL, NULL, NULL);
 }
 
 static int
@@ -320,7 +319,7 @@
 	prefs = sv->priv->prefs;
 	
 	/* Init */
-		gtk_source_buffer_set_highlight_syntax(GTK_SOURCE_BUFFER(sv->priv->document), get_key(sv, HIGHLIGHT_SYNTAX));
+  gtk_source_buffer_set_highlight_syntax(GTK_SOURCE_BUFFER(sv->priv->document), get_key(sv, HIGHLIGHT_SYNTAX));
 	gtk_source_view_set_highlight_current_line(GTK_SOURCE_VIEW(sv->priv->view),
 																						 get_key(sv, HIGHLIGHT_CURRENT_LINE));
 	gtk_source_view_set_tab_width(GTK_SOURCE_VIEW(sv->priv->view), get_key(sv, TAB_SIZE));
@@ -342,8 +341,8 @@
 	init_colors_and_fonts(sv);
 	
 	/* Register gconf notifications */
-		REGISTER_NOTIFY (TAB_SIZE, on_gconf_notify_tab_size);
-	REGISTER_NOTIFY (TAB_SIZE, on_gconf_notify_indent_size);	
+	REGISTER_NOTIFY (TAB_SIZE, on_gconf_notify_tab_size);
+	REGISTER_NOTIFY (INDENT_SIZE, on_gconf_notify_indent_size);	
 	REGISTER_NOTIFY (USE_TABS, on_gconf_notify_use_tab_for_indentation);
 	REGISTER_NOTIFY (HIGHLIGHT_SYNTAX, on_gconf_notify_disable_hilite);
 	REGISTER_NOTIFY (HIGHLIGHT_CURRENT_LINE, on_gconf_notify_highlight_current_line);

Modified: branches/anjuta-symbol-db/plugins/sourceview/sourceview.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/sourceview/sourceview.c	(original)
+++ branches/anjuta-symbol-db/plugins/sourceview/sourceview.c	Mon Feb 11 23:31:06 2008
@@ -449,8 +449,6 @@
 	Sourceview *cobj;
 	cobj = ANJUTA_SOURCEVIEW(object);
 	
-	DEBUG_PRINT("=========== finalise =============");
-	
 	sourceview_remove_monitor(cobj);
 	sourceview_prefs_destroy(cobj);
 	
@@ -458,6 +456,7 @@
 	
 	g_slice_free(SourceviewPrivate, cobj->priv);
 	G_OBJECT_CLASS(parent_class)->finalize(object);
+	DEBUG_PRINT("=========== finalise =============");
 }
 
 /* Sync with IANJUTA_MARKABLE_MARKER  */
@@ -1469,7 +1468,7 @@
 	name = CREATE_MARK_NAME (marker_count);
 	
 	
-	source_mark = gtk_source_buffer_create_mark(GTK_SOURCE_BUFFER(sv->priv->document), 
+	source_mark = gtk_source_buffer_create_source_mark(GTK_SOURCE_BUFFER(sv->priv->document), 
 												name, category, &iter);
 	
 	g_source_remove (svmark->source);
@@ -1514,7 +1513,7 @@
 	gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (buffer), &begin, LOCATION_TO_LINE (location));
 	gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (buffer), &end, LOCATION_TO_LINE (location));
 	
-	gtk_source_buffer_remove_marks (buffer, &begin, &end, marker_types[marker]);
+	gtk_source_buffer_remove_source_marks (buffer, &begin, &end, marker_types[marker]);
 	
 }
 
@@ -1527,7 +1526,7 @@
 	GSList* markers;
 	gboolean retval;
 	
-	markers = gtk_source_buffer_get_marks_at_line (buffer, 
+	markers = gtk_source_buffer_get_source_marks_at_line (buffer, 
 												   LOCATION_TO_LINE (location), 
 												   marker_types[marker]);	
 	
@@ -1573,7 +1572,7 @@
 	gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (buffer), &begin, 0);
 	gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (buffer), &end, -1);
 	
-	gtk_source_buffer_remove_marks (buffer, &begin, &end, marker_types[marker]);
+	gtk_source_buffer_remove_source_marks (buffer, &begin, &end, marker_types[marker]);
 }
 
 static void
@@ -1652,7 +1651,7 @@
 	
 	GSList* markers;
 	
-	markers = gtk_source_buffer_get_marks_at_line (buffer, LOCATION_TO_LINE (location),
+	markers = gtk_source_buffer_get_source_marks_at_line (buffer, LOCATION_TO_LINE (location),
 												   marker_types[IANJUTA_MARKABLE_BOOKMARK]);
 	if (markers != NULL)
 	{
@@ -1662,7 +1661,7 @@
 		gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (buffer), &begin, LOCATION_TO_LINE (location));
 		gtk_text_buffer_get_iter_at_line (GTK_TEXT_BUFFER (buffer), &end, LOCATION_TO_LINE (location));
 		
-		gtk_source_buffer_remove_marks (buffer, &begin, &end, 
+		gtk_source_buffer_remove_source_marks (buffer, &begin, &end, 
 										marker_types[IANJUTA_MARKABLE_BOOKMARK]);
 	}
 	else
@@ -1673,7 +1672,7 @@
 															 &line, LOCATION_TO_LINE (location));
 		
 		bookmark = 
-			gtk_source_buffer_create_mark (buffer, NULL,
+			gtk_source_buffer_create_source_mark (buffer, NULL,
 											 marker_types [IANJUTA_MARKABLE_BOOKMARK],
 											 &line);
 	}
@@ -1686,10 +1685,10 @@
 	gboolean found = FALSE;
 	
 	if (backward)
-		found = gtk_source_buffer_backward_iter_to_mark (buffer, iter, 
+		found = gtk_source_buffer_backward_iter_to_source_mark (buffer, iter, 
 														 marker_types[IANJUTA_MARKABLE_BOOKMARK]);
 	else
-		found = gtk_source_buffer_forward_iter_to_mark (buffer, iter, 
+		found = gtk_source_buffer_forward_iter_to_source_mark (buffer, iter, 
 														marker_types[IANJUTA_MARKABLE_BOOKMARK]);
 	if (found)
 	{
@@ -1763,7 +1762,7 @@
 	gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (buffer), &begin, 0);
 	gtk_text_buffer_get_iter_at_offset (GTK_TEXT_BUFFER (buffer), &end, -1);
 	
-	gtk_source_buffer_remove_marks (buffer, &begin, &end, marker_types[IANJUTA_MARKABLE_BOOKMARK]);
+	gtk_source_buffer_remove_source_marks (buffer, &begin, &end, marker_types[IANJUTA_MARKABLE_BOOKMARK]);
 }
 
 static void
@@ -1993,7 +1992,13 @@
 				   gint char_alignment, GError **err)
 {
 	Sourceview* sv = ANJUTA_SOURCEVIEW(iassist);
-	int tip_position = ianjuta_iterable_get_position (ipos, NULL) - char_alignment;
+	GtkTextBuffer* buffer = GTK_TEXT_BUFFER (sv->priv->document);
+	GtkTextIter iter;
+	gint tip_position;
+	gtk_text_buffer_get_iter_at_mark (buffer, &iter,
+									  gtk_text_buffer_get_insert (buffer));
+	
+	tip_position = gtk_text_iter_get_offset (&iter) - char_alignment;
 	
 	if (tips == NULL)
 		return;

Modified: branches/anjuta-symbol-db/plugins/symbol-browser/plugin.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-browser/plugin.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-browser/plugin.c	Mon Feb 11 23:31:06 2008
@@ -1214,6 +1214,9 @@
 											gint text_pos,
 							 				GError **err)
 {
+	DEBUG_PRINT ("deprecated");
+	return NULL;
+#if 0	
 	SymbolBrowserPlugin *sv_plugin;
 	const TMTag *func_scope_tag;
 	TMSourceFile *tm_file;
@@ -1283,6 +1286,7 @@
 		return IANJUTA_ITERABLE (iter);
 	}
 	return NULL;
+#endif	
 }
 
 static void

Modified: branches/anjuta-symbol-db/plugins/symbol-db/Makefile.am
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/Makefile.am	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/Makefile.am	Mon Feb 11 23:31:06 2008
@@ -2,17 +2,12 @@
 
 #SUBDIRS = test
 
-# Plugin UI file
-symbol_db_uidir = $(anjuta_ui_dir)
-symbol_db_ui_DATA =  symbol-db.ui
-
 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 \
@@ -69,28 +57,27 @@
     symbol-db-engine-iterator-node.h \
 	symbol-db-engine-iterator-node.c
 
+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
+
+libanjuta_symbol_db_la_DEPENDENCIES = \
+	build-schema-files 
 
 EXTRA_DIST = \
 	$(plugin_in_files) \
 	$(symbol_db_plugin_DATA) \
-	$(symbol_db_ui_DATA) \
 	$(symbol_db_glade_DATA) \
 	$(symbol_db_pixmaps_DATA)
 
-
-
-
-
-
-
-
-
+endif
 
 
 

Modified: branches/anjuta-symbol-db/plugins/symbol-db/plugin.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/plugin.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/plugin.c	Mon Feb 11 23:31:06 2008
@@ -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>
 
@@ -47,14 +48,17 @@
 #include "symbol-db-engine.h"
 #include "symbol-db-engine-iterator.h"
 
-#define UI_FILE ANJUTA_DATA_DIR"/ui/symbol-db.ui"
-
-#define GLADE_FILE ANJUTA_DATA_DIR"/glade/symbol-db.glade"
+#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 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"
+
 static gpointer parent_class;
 static gboolean need_symbols_update = FALSE;
 static gchar prev_char_added = ' ';
@@ -732,7 +736,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, 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);				
+
+	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), "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_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, 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);				
+				
+	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 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 
+		{
+			/* 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), "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 (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
@@ -760,7 +984,6 @@
 		{
 			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, 
@@ -801,140 +1024,27 @@
 				g_error ("Symbol-DB: error in opening project");
 			}
 
-			/* 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);
-				
+				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);
+
+				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;
+					do_import_sources_after_abort (plugin, root_dir, sources_array);
 					
-					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 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 */
-			{
+				/* Update the symbols */
 				symbol_db_engine_update_project_symbols (sdb_plugin->sdbe, root_dir);
 			}
 			anjuta_status_progress_tick (status, NULL, _("Populating symbols' db..."));
@@ -945,6 +1055,8 @@
 
 			/* 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);
@@ -1007,7 +1119,8 @@
 
 	symbol_db = ANJUTA_PLUGIN_SYMBOL_DB (plugin);
 	symbol_db->ui = anjuta_shell_get_ui (plugin->shell, NULL);
-
+	symbol_db->prefs = anjuta_shell_get_preferences (plugin->shell, NULL);
+	
 	/* create SymbolDBEngine */
 	symbol_db->sdbe = symbol_db_engine_new ();
 	
@@ -1312,8 +1425,92 @@
 	iface->get_class_parents = isymbol_manager_get_class_parents;
 }
 
+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 void
+ipreferences_merge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError** e)
+{
+	GladeXML *gxml;
+	GtkWidget *fchooser;
+	SymbolDBPlugin *sdb_plugin;	
+	gchar *ctags_value;
+	
+	DEBUG_PRINT ("SymbolDB: ipreferences_merge");	
+	
+	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (ipref);
+	
+	/* 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);	
+	g_object_unref (gxml);
+	g_free (ctags_value);
+}
+
+static void
+ipreferences_unmerge(IAnjutaPreferences* ipref, AnjutaPreferences* prefs, GError** e)
+{
+	SymbolDBPlugin *sdb_plugin;	
+
+	sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (ipref);
+	
+	anjuta_preferences_notify_remove(prefs, sdb_plugin->prefs_notify_id);
+	anjuta_preferences_remove_page(prefs, _("Symbol Database"));
+}
+
+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: branches/anjuta-symbol-db/plugins/symbol-db/plugin.h
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/plugin.h	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/plugin.h	Mon Feb 11 23:31:06 2008
@@ -48,6 +48,8 @@
 	AnjutaUI *ui;
 	AnjutaPreferences *prefs;
 	
+	gint prefs_notify_id;
+	
 	/* project monitor */
 	guint root_watch_id;
 	 

Modified: branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.c	Mon Feb 11 23:31:06 2008
@@ -122,7 +122,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"
 
@@ -158,6 +158,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,
@@ -272,7 +273,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,
@@ -794,7 +801,7 @@
 		files_scanned_DEBUG = 0;
 	}
 	
-	DEBUG_PRINT ("EMITTING single-file-scan-end");
+	DEBUG_PRINT ("EMITTING single-file-scan-end: %s", base_prj_path);
 	/* notify listeners that another file has been scanned */
 	g_async_queue_push (priv->signals_queue, (gpointer)(SINGLE_FILE_SCAN_END +1));
 	
@@ -889,7 +896,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 ()");
@@ -907,7 +914,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);
 						
@@ -922,7 +928,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));
@@ -937,8 +942,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 */
@@ -954,10 +957,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 
 	{
@@ -1200,7 +1203,9 @@
 		DEBUG_PRINT ("creating anjuta_launcher");
 		priv->ctags_launcher = anjuta_launcher_new ();
 
-		anjuta_launcher_disable_password_check (priv->ctags_launcher, TRUE);
+		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);
 
@@ -1258,7 +1263,7 @@
 			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");
 
@@ -2585,10 +2590,12 @@
 
 	g_return_val_if_fail (priv->db_connection != NULL, FALSE);
 	g_return_val_if_fail (project != NULL, FALSE);
+	g_return_val_if_fail (files_path->len > 0, FALSE);
+	g_return_val_if_fail (languages->len > 0, FALSE);
 
 	if (symbol_db_engine_is_project_opened (dbe, project) == FALSE) 
 	{
-		g_warning ("your project isn't opened, %s (priv %s)", project, 
+		g_warning ("Your project isn't opened, %s (priv %s)", project, 
 				   priv->project_name);
 		return FALSE;
 	}	
@@ -5016,6 +5023,7 @@
 		file_name = g_value_get_string (value);
 		if (priv->data_source != NULL)
 		{
+			/* FIXME */
 			abs_vfs_path = g_strdup_printf ("file://%s%s", priv->data_source,
 										file_name);
 			file_abs_path = g_strdup_printf ("%s%s", priv->data_source,
@@ -5023,6 +5031,7 @@
 		}
 		else
 		{
+			/* FIXME */
 			abs_vfs_path = g_strdup_printf ("file://%s", file_name);
 			file_abs_path = g_strdup (file_name);
 		}
@@ -5414,6 +5423,107 @@
 }
 
 
+/**
+ * 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.
+ */
+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;
+	const GdaQuery *query;
+	GdaObject *query_result;	
+	GPtrArray *files_to_scan;
+	gint i, num_rows = 0;
+	GdaDataModel *data;
+	gchar *query_str;
+
+	g_return_val_if_fail (dbe != NULL, NULL);
+	priv = dbe->priv;
+	
+	if (priv->mutex)
+		g_mutex_lock (priv->mutex);
+	
+/*	
+	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;
+	}
+
+	if (GDA_QUERY_TYPE_NON_PARSED_SQL ==
+		gda_query_get_query_type ((GdaQuery *) query))
+	{
+		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 = sdb_engine_execute_select_sql (dbe, query_str)) == NULL ||
+		  (num_rows = gda_data_model_get_n_rows (data)) <= 0 ) 
+	{
+		if (priv->mutex)
+			g_mutex_unlock (priv->mutex);
+		
+		return NULL;
+	}
+	
+	/*
+		
+	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;
+	}*/
+
+	/* 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++)
+	{
+		const GValue *value;
+		const gchar *file_name;
+		gchar *file_abs_path = NULL;
+
+		if ((value =
+			 gda_data_model_get_value_at_col_name (data,
+												   "file_path", i)) == NULL)
+		{
+			continue;
+		}
+
+		/* build abs path. */
+		file_name = g_value_get_string (value);
+		if (priv->data_source != NULL)
+		{
+			file_abs_path = g_strdup_printf ("%s%s", priv->data_source,
+										file_name);
+		}
+		g_ptr_array_add (files_to_scan, file_abs_path);
+	}
+
+	g_free (query_str);
+	g_object_unref (data);
+	
+	if (priv->mutex)
+		g_mutex_unlock (priv->mutex);
+	
+	return files_to_scan;
+}
+
 static inline void
 sdb_engine_prepare_symbol_info_sql (SymbolDBEngine *dbe, GString *info_data,
 									GString *join_data, SymExtraInfo sym_info) 
@@ -6769,9 +6879,10 @@
 		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 ) 
 	{
@@ -6794,3 +6905,4 @@
 	return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data, 
 												priv->sym_type_conversion_hash);	
 }
+

Modified: branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.h
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.h	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-engine.h	Mon Feb 11 23:31:06 2008
@@ -234,6 +234,15 @@
 GPtrArray *
 symbol_db_engine_fill_type_array (IAnjutaSymbolType match_types);
 
+/**
+ * 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

Modified: branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-view.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-view.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/symbol-db-view.c	Mon Feb 11 23:31:06 2008
@@ -514,7 +514,6 @@
 				}
 				else 
 				{
-					DEBUG_PRINT ("add_new_waiting_for (dbv, parent_symbol_id, symbol_name, symbol_id, ");
 					/* add it to the waiting_for trigger list */
 					add_new_waiting_for (dbv, parent_symbol_id, symbol_name, symbol_id, 
 										 pixbuf);
@@ -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;
 		}		
 		
@@ -890,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);
 	}		
 		
@@ -1720,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;
 			}		
 		
@@ -1752,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: branches/anjuta-symbol-db/plugins/symbol-db/symbol-db.ui
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/symbol-db.ui	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/symbol-db.ui	Mon Feb 11 23:31:06 2008
@@ -1,6 +0,0 @@
-<!--*- xml -*-->
-<ui>
-	<toolbar name="ToolbarSymbolsDB">
-		<toolitem name="SymbolDB" action="ActionGotoSymbolDB"/>
-	</toolbar>
-</ui>

Modified: branches/anjuta-symbol-db/plugins/symbol-db/test/Makefile.am
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/test/Makefile.am	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/test/Makefile.am	Mon Feb 11 23:31:06 2008
@@ -26,7 +26,11 @@
 	../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 = \

Modified: branches/anjuta-symbol-db/plugins/symbol-db/test/main.c
==============================================================================
--- branches/anjuta-symbol-db/plugins/symbol-db/test/main.c	(original)
+++ branches/anjuta-symbol-db/plugins/symbol-db/test/main.c	Mon Feb 11 23:31:06 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
@@ -457,7 +459,7 @@
 }
 #endif
 
-#if 1
+#if 0
 
 #include <libgda/libgda.h>
 #include <stdio.h>
@@ -521,9 +523,61 @@
 
 	return 0;
 }
+#endif
 
 
+#include "pkg.h"
+#include "parse.h"
 
+int main(int argc, char** argv)
+{
+  	g_thread_init(NULL);
+  	gtk_init (&argc, &argv);
+	gchar *search_path;
+  
+	GSList *packages;
+	package_init  ();	
+  search_path = getenv ("PKG_CONFIG_PATH");
+  if (search_path) 
+    {
+      add_search_dirs(search_path, G_SEARCHPATH_SEPARATOR_S);
+    }
+	
+	g_message ("got search patch %s", search_path);
+	
+  if (getenv("PKG_CONFIG_LIBDIR") != NULL) 
+    {
+      add_search_dirs(getenv("PKG_CONFIG_LIBDIR"), G_SEARCHPATH_SEPARATOR_S);
+    }
+	
 
-#endif
+	//print_package_list ();
+		
+	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;
+	}
+
+	gchar *output = packages_get_I_cflags (packages);
+	g_message ("Got this %s", output);
+	*/
+	
+  	gtk_main();
+	
+	return 0;
+}
 



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