[gtksourceview] CompletionModel: fix unmarked nodes removal



commit 02c70664c791bdca0ba29b8a991a8447c36ac3d4
Author: SÃbastien Wilmet <sebastien wilmet gmail com>
Date:   Mon Apr 9 00:55:05 2012 +0200

    CompletionModel: fix unmarked nodes removal
    
    Take into account the fact that the nodes can be filtered.
    
    Also, after removing the unmarked nodes, if there is no remaining nodes,
    the header was removed only if 'show-headers' is true. But if
    'show-headers' is false, the node is still there (but filtered) and
    needs to be removed too.
    
    This finally fixes bug #629055 "GtkSourceCompletion show-headers
    property: Critical messages and crash":
    
    https://bugzilla.gnome.org/show_bug.cgi?id=629055

 gtksourceview/gtksourcecompletionmodel.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletionmodel.c b/gtksourceview/gtksourcecompletionmodel.c
index f2abc6e..4366d06 100644
--- a/gtksourceview/gtksourcecompletionmodel.c
+++ b/gtksourceview/gtksourcecompletionmodel.c
@@ -1051,7 +1051,7 @@ remove_unmarked (GtkSourceCompletionModel    *model,
 			break;
 		}
 
-		if (path == NULL)
+		if (!node->filtered && path == NULL)
 		{
 			path = path_from_list (model, item);
 		}
@@ -1062,12 +1062,15 @@ remove_unmarked (GtkSourceCompletionModel    *model,
 
 			remove_node (model, info, item, path);
 			item = next;
+			continue;
 		}
-		else
+
+		if (!node->filtered)
 		{
 			gtk_tree_path_next (path);
-			item = g_list_next (item);
 		}
+
+		item = g_list_next (item);
 	}
 
 	if (path != NULL)
@@ -1075,13 +1078,13 @@ remove_unmarked (GtkSourceCompletionModel    *model,
 		gtk_tree_path_free (path);
 	}
 
-	if (info->num_proposals == 0 && info->first != NULL && model->priv->show_headers)
-	{
-		remove_node (model, info, info->first, NULL);
-	}
-
 	if (info->num_proposals == 0)
 	{
+		if (info->first != NULL)
+		{
+			remove_node (model, info, info->first, NULL);
+		}
+
 		g_hash_table_remove (model->priv->providers_info, provider);
 
 		model->priv->providers = g_list_remove (model->priv->providers,



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