[gtksourceview] CompletionModel: fix header visibility update



commit eadc786a117b83f9ec8591f091e8c994b6dcf88a
Author: SÃbastien Wilmet <sebastien wilmet gmail com>
Date:   Mon Apr 9 00:15:45 2012 +0200

    CompletionModel: fix header visibility update
    
    If the provider is filtered, the header's filtered property was not
    updated. It's safer to always update the property.

 gtksourceview/gtksourcecompletionmodel.c |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletionmodel.c b/gtksourceview/gtksourcecompletionmodel.c
index dd63e4e..4325ec3 100644
--- a/gtksourceview/gtksourcecompletionmodel.c
+++ b/gtksourceview/gtksourcecompletionmodel.c
@@ -851,23 +851,31 @@ update_header_visibility_each (GtkSourceCompletionProvider *provider,
                                ProviderInfo                *info,
                                GtkSourceCompletionModel    *model)
 {
-	ProposalNode *header_node = info->first->data;
+	ProposalNode *header_node;
 
-	/* Check if the header is already in the correct visibility state */
-	if (info->filtered || model->priv->show_headers != header_node->filtered)
+	g_assert (info->first != NULL);
+
+	header_node = info->first->data;
+
+	/* The header is already in the correct visibility state */
+	if (header_node->filtered != model->priv->show_headers)
 	{
 		return;
 	}
 
-	if (model->priv->show_headers)
-	{
-		header_node->filtered = FALSE;
-		handle_row_inserted (model, info->first, NULL);
-	}
-	else
+	/* Update the visibility state */
+	header_node->filtered = !model->priv->show_headers;
+
+	if (!info->filtered)
 	{
-		header_node->filtered = TRUE;
-		handle_row_deleted (model, info->first, NULL);
+		if (model->priv->show_headers)
+		{
+			handle_row_inserted (model, info->first, NULL);
+		}
+		else
+		{
+			handle_row_deleted (model, info->first, NULL);
+		}
 	}
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]