[gtksourceview] Completion: more robust get_selected_proposal()



commit d97dedace33465c13b4324c9a0c42cc92fa1d6a7
Author: SÃbastien Wilmet <swilmet gnome org>
Date:   Sat Sep 15 17:17:41 2012 +0200

    Completion: more robust get_selected_proposal()
    
    The header can't be selected, normally. But when proposals are
    removed/inserted by the model, it can occur. In this case, the function
    should return false to mean that no proposal is selected.

 gtksourceview/gtksourcecompletion.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index e8c13a5..fc066ea 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -192,6 +192,11 @@ get_selected_proposal (GtkSourceCompletion          *completion,
 
 	if (gtk_tree_selection_get_selected (selection, NULL, &piter))
 	{
+		if (gtk_source_completion_model_iter_is_header (completion->priv->model_proposals, &piter))
+		{
+			return FALSE;
+		}
+
 		model = GTK_TREE_MODEL (completion->priv->model_proposals);
 
 		if (proposal)



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