Kaydet (Commit) 3973362c authored tarafından Colomban Wendling's avatar Colomban Wendling

Merge pull request #486 from techee/fix_empty_symbol_tree

Fix empty symbol tree under some conditions
...@@ -78,6 +78,8 @@ typedef struct GeanyDocumentPrivate ...@@ -78,6 +78,8 @@ typedef struct GeanyDocumentPrivate
GtkWidget *tag_tree; GtkWidget *tag_tree;
/* GtkTreeStore object for this document within the Symbols treeview of the sidebar. */ /* GtkTreeStore object for this document within the Symbols treeview of the sidebar. */
GtkTreeStore *tag_store; 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. */ /* Iter for this document within the Open Files treeview of the sidebar. */
GtkTreeIter iter; GtkTreeIter iter;
/* Used by the Undo/Redo management code. */ /* Used by the Undo/Redo management code. */
......
...@@ -192,6 +192,9 @@ void sidebar_update_tag_list(GeanyDocument *doc, gboolean update) ...@@ -192,6 +192,9 @@ void sidebar_update_tag_list(GeanyDocument *doc, gboolean update)
g_return_if_fail(doc == NULL || doc->is_valid); 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) 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 */ 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) ...@@ -219,7 +222,7 @@ void sidebar_update_tag_list(GeanyDocument *doc, gboolean update)
return; return;
} }
if (update) if (doc->priv->tag_tree_dirty)
{ /* updating the tag list in the left tag window */ { /* updating the tag list in the left tag window */
if (doc->priv->tag_tree == NULL) if (doc->priv->tag_tree == NULL)
{ {
...@@ -232,6 +235,7 @@ void sidebar_update_tag_list(GeanyDocument *doc, gboolean update) ...@@ -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->has_tags = symbols_recreate_tag_list(doc, SYMBOLS_SORT_USE_PREVIOUS);
doc->priv->tag_tree_dirty = FALSE;
} }
if (doc->has_tags) if (doc->has_tags)
...@@ -1088,7 +1092,7 @@ static void on_sidebar_switch_page(GtkNotebook *notebook, ...@@ -1088,7 +1092,7 @@ static void on_sidebar_switch_page(GtkNotebook *notebook,
gpointer page, guint page_num, gpointer user_data) gpointer page, guint page_num, gpointer user_data)
{ {
if (page_num == TREEVIEW_SYMBOL) if (page_num == TREEVIEW_SYMBOL)
sidebar_update_tag_list(document_get_current(), TRUE); sidebar_update_tag_list(document_get_current(), FALSE);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment