Branch: refs/heads/master Author: Jiří Techet techet@gmail.com Committer: Jiří Techet techet@gmail.com Date: Wed, 06 May 2015 16:48:14 UTC Commit: 1903b0a9b9991733dd48f8cd55446200c647efbd https://github.com/geany/geany/commit/1903b0a9b9991733dd48f8cd55446200c647ef...
Log Message: ----------- Add a flag indicating the tag tree needs updating
When the Symbols tab isn't shown, symbol tree isn't updated. However, we should record the cases when update should have been performed and once the symbols tab is shown, perform update if something changed.
Thanks to this patch we also don't have to always perform symbol tree update when switching to the Symbols tab but only when something has actually changed.
Modified Paths: -------------- src/documentprivate.h src/sidebar.c
Modified: src/documentprivate.h 2 lines changed, 2 insertions(+), 0 deletions(-) =================================================================== @@ -78,6 +78,8 @@ typedef struct GeanyDocumentPrivate GtkWidget *tag_tree; /* GtkTreeStore object for this document within the Symbols treeview of the sidebar. */ GtkTreeStore *tag_store; + /* Indicates whether tag tree has to be updated */ + gboolean tag_tree_dirty; /* Iter for this document within the Open Files treeview of the sidebar. */ GtkTreeIter iter; /* Used by the Undo/Redo management code. */
Modified: src/sidebar.c 8 lines changed, 6 insertions(+), 2 deletions(-) =================================================================== @@ -192,6 +192,9 @@ void sidebar_update_tag_list(GeanyDocument *doc, gboolean update)
g_return_if_fail(doc == NULL || doc->is_valid);
+ if (update) + doc->priv->tag_tree_dirty = TRUE; + if (gtk_notebook_get_current_page(GTK_NOTEBOOK(main_widgets.sidebar_notebook)) != TREEVIEW_SYMBOL) return; /* don't bother updating symbol tree if we don't see it */
@@ -219,7 +222,7 @@ void sidebar_update_tag_list(GeanyDocument *doc, gboolean update) return; }
- if (update) + if (doc->priv->tag_tree_dirty) { /* updating the tag list in the left tag window */ if (doc->priv->tag_tree == NULL) { @@ -232,6 +235,7 @@ void sidebar_update_tag_list(GeanyDocument *doc, gboolean update) }
doc->has_tags = symbols_recreate_tag_list(doc, SYMBOLS_SORT_USE_PREVIOUS); + doc->priv->tag_tree_dirty = FALSE; }
if (doc->has_tags) @@ -1088,7 +1092,7 @@ static void on_sidebar_switch_page(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data) { if (page_num == TREEVIEW_SYMBOL) - sidebar_update_tag_list(document_get_current(), TRUE); + sidebar_update_tag_list(document_get_current(), FALSE); }
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).