[gtksourceview] CompletionModel: remove n_proposals()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] CompletionModel: remove n_proposals()
- Date: Mon, 4 Mar 2013 16:07:53 +0000 (UTC)
commit 20c08b7beefef86277a90f22eb50502066b8692f
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Feb 27 15:03:25 2013 +0100
CompletionModel: remove n_proposals()
It was used for checking if a provider is not empty. But if a provider
is present in the model, it means that it is not empty.
gtksourceview/gtksourcecompletionmodel.c | 32 ----------------------
gtksourceview/gtksourcecompletionmodel.h | 4 ---
tests/test-completion-model.c | 43 ------------------------------
3 files changed, 0 insertions(+), 79 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletionmodel.c b/gtksourceview/gtksourcecompletionmodel.c
index 0e28615..15296bd 100644
--- a/gtksourceview/gtksourcecompletionmodel.c
+++ b/gtksourceview/gtksourcecompletionmodel.c
@@ -918,38 +918,6 @@ gtk_source_completion_model_is_empty (GtkSourceCompletionModel *model,
return TRUE;
}
-/* Returns the number of proposals. The header is not taken into account. */
-guint
-gtk_source_completion_model_n_proposals (GtkSourceCompletionModel *model,
- GtkSourceCompletionProvider *provider)
-{
- GList *provider_node;
- ProviderInfo *provider_info;
- guint nb_items;
-
- g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_MODEL (model), 0);
- g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_PROVIDER (provider), 0);
-
- provider_node = get_provider_node (model, provider);
-
- if (provider_node == NULL)
- {
- return 0;
- }
-
- provider_info = provider_node->data;
- nb_items = provider_info->proposals->length;
-
- if (model->priv->show_headers)
- {
- return nb_items - 1;
- }
- else
- {
- return nb_items;
- }
-}
-
void
gtk_source_completion_model_set_show_headers (GtkSourceCompletionModel *model,
gboolean show_headers)
diff --git a/gtksourceview/gtksourcecompletionmodel.h b/gtksourceview/gtksourcecompletionmodel.h
index 57b6930..f1cedec 100644
--- a/gtksourceview/gtksourcecompletionmodel.h
+++ b/gtksourceview/gtksourcecompletionmodel.h
@@ -88,10 +88,6 @@ G_GNUC_INTERNAL
GList *gtk_source_completion_model_get_providers (GtkSourceCompletionModel *model);
G_GNUC_INTERNAL
-guint gtk_source_completion_model_n_proposals (GtkSourceCompletionModel *model,
- GtkSourceCompletionProvider *provider);
-
-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 36d77bb..6a1b16d 100644
--- a/tests/test-completion-model.c
+++ b/tests/test-completion-model.c
@@ -497,46 +497,6 @@ test_get_providers (void)
}
static void
-test_n_proposals (void)
-{
- GtkSourceCompletionModel *model;
- GtkSourceCompletionProvider *provider;
- GtkSourceCompletionProvider *other_provider;
- GList *list_providers = NULL;
- GList *list_proposals = NULL;
- guint nb_proposals_good = 0;
- guint nb_proposals_get = 0;
-
- model = gtk_source_completion_model_new ();
- provider = GTK_SOURCE_COMPLETION_PROVIDER (test_provider_new ());
- other_provider = GTK_SOURCE_COMPLETION_PROVIDER (test_provider_new ());
- list_providers = g_list_append (NULL, provider);
- list_proposals = create_proposals ();
-
- gtk_source_completion_model_add_proposals (model, provider, list_proposals);
-
- g_assert (gtk_source_completion_model_n_proposals (model, other_provider) == 0);
-
- /* With header */
- gtk_source_completion_model_set_show_headers (model, TRUE);
-
- nb_proposals_good = g_list_length (list_proposals);
- nb_proposals_get = gtk_source_completion_model_n_proposals (model, provider);
- g_assert (nb_proposals_good == nb_proposals_get);
-
- /* Without header */
- gtk_source_completion_model_set_show_headers (model, FALSE);
-
- nb_proposals_get = gtk_source_completion_model_n_proposals (model, provider);
- g_assert (nb_proposals_good == nb_proposals_get);
-
- g_object_unref (model);
- g_object_unref (other_provider);
- g_list_free_full (list_providers, g_object_unref);
- g_list_free_full (list_proposals, g_object_unref);
-}
-
-static void
test_iters_impl (gboolean show_headers)
{
GtkSourceCompletionModel *model = gtk_source_completion_model_new ();
@@ -666,9 +626,6 @@ main (int argc, char **argv)
g_test_add_func ("/CompletionModel/get-providers",
test_get_providers);
- g_test_add_func ("/CompletionModel/n-proposals",
- test_n_proposals);
-
g_test_add_func ("/CompletionModel/iters",
test_iters);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]