[gtksourceview/gtksourcecompletion] Add the first N elements without the idle.



commit 74aee1622e3dbe2ea509d0cf3f0b4f6f88bd4df7
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Tue Apr 21 13:39:42 2009 +0200

    Add the first N elements without the idle.
    
    Make sure we add the first N elements before adding the idle source to make the population instantantly.
---
 gtksourceview/gtksourcecompletion.c      |    2 ++
 gtksourceview/gtksourcecompletionmodel.c |   18 +++++++++++-------
 gtksourceview/gtksourcecompletionmodel.h |    2 ++
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index e00d178..5b23198 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -1970,6 +1970,8 @@ add_proposals (GtkSourceCompletion         *completion,
 		}
 	}
 	
+	gtk_source_completion_model_run_add_proposals (completion->priv->model_proposals);
+	
 	g_list_free (proposals);
 }
 
diff --git a/gtksourceview/gtksourcecompletionmodel.c b/gtksourceview/gtksourcecompletionmodel.c
index 2889325..9c68c31 100644
--- a/gtksourceview/gtksourcecompletionmodel.c
+++ b/gtksourceview/gtksourcecompletionmodel.c
@@ -838,6 +838,17 @@ idle_append (gpointer data)
 }
 
 void
+gtk_source_completion_model_run_add_proposals (GtkSourceCompletionModel *model)
+{
+	if (idle_append (model))
+	{
+		model->priv->idle_id =
+			g_idle_add ((GSourceFunc)idle_append,
+				    model);
+	}
+}
+
+void
 gtk_source_completion_model_append (GtkSourceCompletionModel    *model,
                                     GtkSourceCompletionProvider *provider,
                                     GtkSourceCompletionProposal *proposal)
@@ -855,13 +866,6 @@ gtk_source_completion_model_append (GtkSourceCompletionModel    *model,
 	node->changed_id = 0;
 	
 	g_queue_push_tail (model->priv->item_queue, node);
-	
-	if (model->priv->idle_id == 0)
-	{
-		model->priv->idle_id =
-			g_idle_add ((GSourceFunc)idle_append,
-				    model);
-	}
 }
 
 void
diff --git a/gtksourceview/gtksourcecompletionmodel.h b/gtksourceview/gtksourcecompletionmodel.h
index ba65a13..5844b5c 100644
--- a/gtksourceview/gtksourcecompletionmodel.h
+++ b/gtksourceview/gtksourcecompletionmodel.h
@@ -80,6 +80,8 @@ GtkSourceCompletionModel *
 		gtk_source_completion_model_new 	(GtkSourceCompletionModelVisibleFunc func,
 							 gpointer                            userdata);
 
+void		gtk_source_completion_model_run_add_proposals (GtkSourceCompletionModel *model);
+
 void		gtk_source_completion_model_append 	(GtkSourceCompletionModel           *model,
 							 GtkSourceCompletionProvider        *provider,
 							 GtkSourceCompletionProposal        *proposal);



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