SF.net SVN: geany: [2004] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Nov 1 13:00:33 UTC 2007


Revision: 2004
          http://geany.svn.sourceforge.net/geany/?rev=2004&view=rev
Author:   ntrel
Date:     2007-11-01 06:00:32 -0700 (Thu, 01 Nov 2007)

Log Message:
-----------
Ensure document_update_tag_list() always shows the empty symbol list
when tags cannot be parsed.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/document.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-11-01 12:54:38 UTC (rev 2003)
+++ trunk/ChangeLog	2007-11-01 13:00:32 UTC (rev 2004)
@@ -4,6 +4,9 @@
    Prevent prefs dialog being hidden after using the prefs file dialog.
  * src/build.c, src/prefs.c:
    Enable build support on Windows.
+ * src/document.c:
+   Ensure document_update_tag_list() always shows the empty symbol list
+   when tags cannot be parsed.
 
 
 2007-11-01  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2007-11-01 12:54:38 UTC (rev 2003)
+++ trunk/src/document.c	2007-11-01 13:00:32 UTC (rev 2004)
@@ -1724,13 +1724,14 @@
 
 void document_update_tag_list(gint idx, gboolean update)
 {
+	/* We must call treeviews_update_tag_list() before returning,
+	 * to ensure that the symbol list is always updated properly (e.g.
+	 * when creating a new document with a partial filename set. */
 	gboolean success = FALSE;
 
-	if (app->tm_workspace == NULL)
-		return;
-
 	// if the filetype doesn't have a tag parser or it is a new file
 	if (idx == -1 || doc_list[idx].file_type == NULL ||
+		app->tm_workspace == NULL ||
 		! filetype_has_tags(doc_list[idx].file_type) || ! doc_list[idx].file_name)
 	{
 		// set the default (empty) tag list
@@ -1740,38 +1741,32 @@
 
 	if (doc_list[idx].tm_file == NULL)
 	{
-#ifdef GEANY_OS_WIN32
-		doc_list[idx].tm_file = tm_source_file_new(
-				doc_list[idx].file_name, FALSE, doc_list[idx].file_type->name);
-#else
 		gchar *locale_filename = utils_get_locale_from_utf8(doc_list[idx].file_name);
+
 		doc_list[idx].tm_file = tm_source_file_new(
 				locale_filename, FALSE, doc_list[idx].file_type->name);
 		g_free(locale_filename);
-#endif
+
 		if (doc_list[idx].tm_file)
 		{
 			if (!tm_workspace_add_object(doc_list[idx].tm_file))
 			{
 				tm_work_object_free(doc_list[idx].tm_file);
 				doc_list[idx].tm_file = NULL;
-				return;
 			}
-			if (update)
-				tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE);
-			success = TRUE;
+			else
+			{
+				if (update)
+					tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE);
+				success = TRUE;
+			}
 		}
 	}
 	else
 	{
-		if (tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE))
-		{
-			success = TRUE;
-		}
-		else
-		{
+		success = tm_source_file_update(doc_list[idx].tm_file, TRUE, FALSE, TRUE);
+		if (! success)
 			geany_debug("tag list updating failed");
-		}
 	}
 	treeviews_update_tag_list(idx, success);
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list