SF.net SVN: geany:[5561] trunk/src/sidebar.c
colombanw at users.sourceforge.net
colombanw at xxxxx
Sat Mar 5 22:51:32 UTC 2011
Revision: 5561
http://geany.svn.sourceforge.net/geany/?rev=5561&view=rev
Author: colombanw
Date: 2011-03-05 22:51:32 +0000 (Sat, 05 Mar 2011)
Log Message:
-----------
Don't remove and add the symbols tree view if we re-add the same one
Modified Paths:
--------------
trunk/src/sidebar.c
Modified: trunk/src/sidebar.c
===================================================================
--- trunk/src/sidebar.c 2011-03-05 22:50:04 UTC (rev 5560)
+++ trunk/src/sidebar.c 2011-03-05 22:51:32 UTC (rev 5561)
@@ -198,16 +198,26 @@
/* update = rescan the tags for doc->filename */
void sidebar_update_tag_list(GeanyDocument *doc, gboolean update)
{
- if (gtk_bin_get_child(GTK_BIN(tag_window)))
- gtk_container_remove(GTK_CONTAINER(tag_window), gtk_bin_get_child(GTK_BIN(tag_window)));
+ GtkWidget *child = gtk_bin_get_child(GTK_BIN(tag_window));
+ /* changes the tree view to the given one, trying not to do useless changes */
+ #define CHANGE_TREE(new_child) \
+ G_STMT_START { \
+ if (child != new_child) \
+ { \
+ if (child) \
+ gtk_container_remove(GTK_CONTAINER(tag_window), child); \
+ gtk_container_add(GTK_CONTAINER(tag_window), new_child); \
+ } \
+ } G_STMT_END
+
if (tv.default_tag_tree == NULL)
create_default_tag_tree();
/* show default empty tag tree if there are no tags */
if (doc == NULL || doc->file_type == NULL || ! filetype_has_tags(doc->file_type))
{
- gtk_container_add(GTK_CONTAINER(tag_window), tv.default_tag_tree);
+ CHANGE_TREE(tv.default_tag_tree);
return;
}
@@ -228,12 +238,14 @@
if (doc->has_tags)
{
- gtk_container_add(GTK_CONTAINER(tag_window), doc->priv->tag_tree);
+ CHANGE_TREE(doc->priv->tag_tree);
}
else
{
- gtk_container_add(GTK_CONTAINER(tag_window), tv.default_tag_tree);
+ CHANGE_TREE(tv.default_tag_tree);
}
+
+ #undef CHANGE_TREE
}
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