[gtksourceview] Completion: remove model_clear()



commit ee614a50890ea36267faecb1efe20d54a941df1b
Author: SÃbastien Wilmet <swilmet gnome org>
Date:   Mon Jan 21 16:23:31 2013 +0100

    Completion: remove model_clear()
    
    We create a new CompletionModel for each population, so clearing the
    model is no longer useful.

 gtksourceview/gtksourcecompletion.c      |    2 --
 gtksourceview/gtksourcecompletionmodel.c |   27 ---------------------------
 gtksourceview/gtksourcecompletionmodel.h |    3 ---
 tests/test-completion-model.c            |   28 ----------------------------
 4 files changed, 0 insertions(+), 60 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 0571f51..8fb01e8 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -2184,8 +2184,6 @@ gtk_source_completion_hide_default (GtkSourceCompletion *completion)
 	gtk_widget_hide (completion->priv->info_window);
 	gtk_widget_hide (completion->priv->window);
 
-	gtk_source_completion_model_clear (completion->priv->model_proposals);
-
 	cancel_completion (completion);
 
 	g_list_free (completion->priv->active_providers);
diff --git a/gtksourceview/gtksourcecompletionmodel.c b/gtksourceview/gtksourcecompletionmodel.c
index c9a9935..d13f407 100644
--- a/gtksourceview/gtksourcecompletionmodel.c
+++ b/gtksourceview/gtksourcecompletionmodel.c
@@ -720,8 +720,6 @@ gtk_source_completion_model_begin_populate (GtkSourceCompletionModel *model,
 					    GList                    *providers)
 {
 	g_return_if_fail (GTK_SOURCE_IS_COMPLETION_MODEL (model));
-
-	gtk_source_completion_model_clear (model);
 }
 
 void
@@ -953,31 +951,6 @@ gtk_source_completion_model_get_visible_providers (GtkSourceCompletionModel *mod
 
 /* Other public functions */
 
-void
-gtk_source_completion_model_clear (GtkSourceCompletionModel *model)
-{
-	GList *provider_node;
-
-	g_return_if_fail (GTK_SOURCE_IS_COMPLETION_MODEL (model));
-
-	for (provider_node = model->priv->providers;
-	     provider_node != NULL;
-	     provider_node = g_list_next (provider_node))
-	{
-		ProviderInfo *provider_info = provider_node->data;
-
-		if (provider_info->visible)
-		{
-			hide_provider (model, provider_info);
-			provider_info->visible = FALSE;
-		}
-	}
-
-	g_list_free_full (model->priv->providers, (GDestroyNotify)provider_info_free);
-	model->priv->providers = NULL;
-
-}
-
 /* If @only_visible is %TRUE, only the visible providers are taken into account. */
 gboolean
 gtk_source_completion_model_is_empty (GtkSourceCompletionModel *model,
diff --git a/gtksourceview/gtksourcecompletionmodel.h b/gtksourceview/gtksourcecompletionmodel.h
index 3c1b34d..0b92999 100644
--- a/gtksourceview/gtksourcecompletionmodel.h
+++ b/gtksourceview/gtksourcecompletionmodel.h
@@ -103,9 +103,6 @@ guint    gtk_source_completion_model_n_proposals		(GtkSourceCompletionModel    *
 								 GtkSourceCompletionProvider *provider);
 
 G_GNUC_INTERNAL
-void     gtk_source_completion_model_clear			(GtkSourceCompletionModel    *model);
-
-G_GNUC_INTERNAL
 void     gtk_source_completion_model_set_show_headers		(GtkSourceCompletionModel    *model,
 								 gboolean                     show_headers);
 
diff --git a/tests/test-completion-model.c b/tests/test-completion-model.c
index 05b5d0c..51c5b8b 100644
--- a/tests/test-completion-model.c
+++ b/tests/test-completion-model.c
@@ -391,31 +391,6 @@ test_simple_populate (void)
 }
 
 static void
-test_clear (void)
-{
-	GtkSourceCompletionModel *model;
-	GList *all_providers = NULL;
-	GList *all_list_proposals = NULL;
-
-	model = gtk_source_completion_model_new ();
-
-	/* Clear the model when it is already empty */
-	gtk_source_completion_model_clear (model);
-	g_assert (gtk_source_completion_model_is_empty (model, FALSE));
-
-	/* Add some proposals */
-	create_providers (&all_providers, &all_list_proposals);
-	populate_model (model, all_providers, all_list_proposals);
-
-	/* Clear the model when it is not empty */
-	gtk_source_completion_model_clear (model);
-	g_assert (gtk_source_completion_model_is_empty (model, FALSE));
-
-	g_object_unref (model);
-	free_providers (all_providers, all_list_proposals);
-}
-
-static void
 test_set_visible_providers (void)
 {
 	GtkSourceCompletionModel *model;
@@ -773,9 +748,6 @@ main (int argc, char **argv)
 	g_test_add_func ("/CompletionModel/simple-populate",
 			 test_simple_populate);
 
-	g_test_add_func ("/CompletionModel/clear",
-			 test_clear);
-
 	g_test_add_func ("/CompletionModel/set-visible-providers",
 			 test_set_visible_providers);
 



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