[gtksourceview/gtksourcecompletion] Hide completion when filtering.



commit 29ad7429c84a268dcd28405b76e7a26301d608b8
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Wed Apr 22 20:54:42 2009 +0200

    Hide completion when filtering.
    
    Hide the completion window when filtering finishes and there are no elements on the tree view.
---
 gtksourceview/gtksourcecompletion.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 7596538..22cb284 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -1733,6 +1733,17 @@ on_items_added_cb (GtkSourceCompletionModel *model,
 	}
 }
 
+static void
+on_filter_done_cb (GtkSourceCompletionModel *model,
+		   GtkSourceCompletion      *completion)
+{
+	/* Check if there are any completions */
+	if (gtk_source_completion_model_is_empty (model, FALSE))
+	{
+		gtk_source_completion_hide (completion);
+	}
+}
+
 static GtkWidget *
 initialize_proposals_ui (GtkSourceCompletion *completion)
 {
@@ -1751,6 +1762,11 @@ initialize_proposals_ui (GtkSourceCompletion *completion)
 			  G_CALLBACK (on_items_added_cb),
 			  completion);
 
+	g_signal_connect (completion->priv->model_proposals,
+			  "filter-done",
+			  G_CALLBACK (on_filter_done_cb),
+			  completion);
+
 	gtk_source_completion_model_set_show_headers (completion->priv->model_proposals,
 				                      completion->priv->show_headers);
 	tree_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL (completion->priv->model_proposals));



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