From dcd06b21afa63547d9eb85f24ef8957240cd4706 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Thu, 1 Nov 2007 13:00:32 +0000 Subject: [PATCH] Ensure document_update_tag_list() always shows the empty symbol list when tags cannot be parsed. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2004 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 3 +++ src/document.c | 33 ++++++++++++++------------------- 2 files changed, 17 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index ac02bdec..c10af979 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/src/document.c b/src/document.c index 99afb957..281ea0dd 100644 --- a/src/document.c +++ b/src/document.c @@ -1724,13 +1724,14 @@ void document_set_font(gint idx, const gchar *font_name, gint size) 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 @@ void document_update_tag_list(gint idx, gboolean update) 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); }