[gtksourceview] CompletionModel: simplify second parameter of is_empty()



commit 09129665691747af78778d398b2544682814238b
Author: SÃbastien Wilmet <swilmet gnome org>
Date:   Fri Jan 4 00:20:17 2013 +0100

    CompletionModel: simplify second parameter of is_empty()
    
    Instead of having double negations like "!invisible", it's easier with
    "only_visible".
    
    Add also a comment, because the meaning of the parameter is not obvious.

 gtksourceview/gtksourcecompletion.c      |    4 ++--
 gtksourceview/gtksourcecompletionmodel.c |    5 +++--
 gtksourceview/gtksourcecompletionmodel.h |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index fc066ea..626ffdb 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -800,7 +800,7 @@ select_provider (GtkSourceCompletion *completion,
 					break;
 				}
 			}
-			else if (!gtk_source_completion_model_is_empty (completion->priv->model_proposals, TRUE))
+			else if (!gtk_source_completion_model_is_empty (completion->priv->model_proposals, FALSE))
 			{
 				break;
 			}
@@ -3207,7 +3207,7 @@ populating_done (GtkSourceCompletion        *completion,
                  GtkSourceCompletionContext *context)
 {
 	if (gtk_source_completion_model_is_empty (completion->priv->model_proposals,
-	                                          FALSE))
+	                                          TRUE))
 	{
 		DEBUG({
 			g_print ("Model is empty after populating\n");
diff --git a/gtksourceview/gtksourcecompletionmodel.c b/gtksourceview/gtksourcecompletionmodel.c
index 09176f3..0395796 100644
--- a/gtksourceview/gtksourcecompletionmodel.c
+++ b/gtksourceview/gtksourcecompletionmodel.c
@@ -1365,15 +1365,16 @@ provider_has_proposals (GtkSourceCompletionProvider *provider,
 	}
 }
 
+/* If @only_visible is %TRUE, only the visible providers are taken into account. */
 gboolean
 gtk_source_completion_model_is_empty (GtkSourceCompletionModel *model,
-                                      gboolean                  invisible)
+                                      gboolean                  only_visible)
 {
 	gboolean isempty = TRUE;
 
 	g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_MODEL (model), FALSE);
 
-	if (!invisible)
+	if (only_visible)
 	{
 		g_hash_table_foreach (model->priv->providers_info,
 		                      (GHFunc)provider_has_proposals,
diff --git a/gtksourceview/gtksourcecompletionmodel.h b/gtksourceview/gtksourcecompletionmodel.h
index ef3b66d..9a19f11 100644
--- a/gtksourceview/gtksourcecompletionmodel.h
+++ b/gtksourceview/gtksourcecompletionmodel.h
@@ -88,7 +88,7 @@ void     gtk_source_completion_model_cancel			(GtkSourceCompletionModel    *mode
 
 G_GNUC_INTERNAL
 gboolean gtk_source_completion_model_is_empty			(GtkSourceCompletionModel    *model,
-								 gboolean                     invisible);
+								 gboolean                     only_visible);
 
 G_GNUC_INTERNAL
 void     gtk_source_completion_model_set_visible_providers	(GtkSourceCompletionModel    *model,



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