[gtksourceview] CompletionModel: change iter_last() as static
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] CompletionModel: change iter_last() as static
- Date: Mon, 4 Mar 2013 16:07:22 +0000 (UTC)
commit 469daf6c694ac8443aa4bd2ba04c0a34bd5a1192
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Feb 26 20:55:10 2013 +0100
CompletionModel: change iter_last() as static
Since this function is no longer used outside CompletionModel.
Adapt also the unit tests.
gtksourceview/gtksourcecompletionmodel.c | 62 +++++++++++++++---------------
gtksourceview/gtksourcecompletionmodel.h | 4 --
tests/test-completion-model.c | 8 ++--
3 files changed, 35 insertions(+), 39 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletionmodel.c b/gtksourceview/gtksourcecompletionmodel.c
index edd2cfb..d465c6e 100644
--- a/gtksourceview/gtksourcecompletionmodel.c
+++ b/gtksourceview/gtksourcecompletionmodel.c
@@ -255,6 +255,36 @@ get_provider_node (GtkSourceCompletionModel *model,
return NULL;
}
+static gboolean
+get_last_iter (GtkSourceCompletionModel *model,
+ GtkTreeIter *iter)
+{
+ GList *last_provider;
+ ProviderInfo *provider_info;
+
+ g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_MODEL (model), FALSE);
+ g_return_val_if_fail (iter != NULL, FALSE);
+
+ last_provider = g_list_last (model->priv->providers);
+
+ if (last_provider == NULL)
+ {
+ return FALSE;
+ }
+
+ provider_info = last_provider->data;
+
+ iter->user_data = provider_info->proposals->tail;
+ g_assert (iter->user_data != NULL);
+
+ if (!provider_info->visible)
+ {
+ return gtk_source_completion_model_iter_previous (model, iter);
+ }
+
+ return TRUE;
+}
+
/* Remove providers or proposals */
static void
@@ -1077,36 +1107,6 @@ gtk_source_completion_model_iter_previous (GtkSourceCompletionModel *model,
return TRUE;
}
-gboolean
-gtk_source_completion_model_iter_last (GtkSourceCompletionModel *model,
- GtkTreeIter *iter)
-{
- GList *last_provider;
- ProviderInfo *provider_info;
-
- g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_MODEL (model), FALSE);
- g_return_val_if_fail (iter != NULL, FALSE);
-
- last_provider = g_list_last (model->priv->providers);
-
- if (last_provider == NULL)
- {
- return FALSE;
- }
-
- provider_info = last_provider->data;
-
- iter->user_data = provider_info->proposals->tail;
- g_assert (iter->user_data != NULL);
-
- if (!provider_info->visible)
- {
- return gtk_source_completion_model_iter_previous (model, iter);
- }
-
- return TRUE;
-}
-
/* Get all the providers (visible and hidden), sorted by priority in descending
* order (the highest priority first).
* Free the return value with g_list_free().
@@ -1164,7 +1164,7 @@ gtk_source_completion_model_last_proposal (GtkSourceCompletionModel *model,
g_return_val_if_fail (GTK_SOURCE_IS_COMPLETION_MODEL (model), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
- if (!gtk_source_completion_model_iter_last (model, iter))
+ if (!get_last_iter (model, iter))
{
return FALSE;
}
diff --git a/gtksourceview/gtksourcecompletionmodel.h b/gtksourceview/gtksourcecompletionmodel.h
index e0b52c8..57b6930 100644
--- a/gtksourceview/gtksourcecompletionmodel.h
+++ b/gtksourceview/gtksourcecompletionmodel.h
@@ -104,10 +104,6 @@ gboolean gtk_source_completion_model_iter_previous (GtkSourceCompletionModel
GtkTreeIter *iter);
G_GNUC_INTERNAL
-gboolean gtk_source_completion_model_iter_last (GtkSourceCompletionModel *model,
- GtkTreeIter *iter);
-
-G_GNUC_INTERNAL
gboolean gtk_source_completion_model_first_proposal (GtkSourceCompletionModel *model,
GtkTreeIter *iter);
diff --git a/tests/test-completion-model.c b/tests/test-completion-model.c
index 2768fd9..36d77bb 100644
--- a/tests/test-completion-model.c
+++ b/tests/test-completion-model.c
@@ -549,17 +549,17 @@ test_iters_impl (gboolean show_headers)
gint nb_items;
gint *indices;
- /* Test iter_last() */
- g_assert (!gtk_source_completion_model_iter_last (model, &last_iter));
+ /* Test last_proposal() */
+ g_assert (!gtk_source_completion_model_last_proposal (model, &last_iter));
create_providers (&all_providers, &all_list_proposals);
populate_model (model, all_providers, all_list_proposals);
gtk_source_completion_model_set_show_headers (model, show_headers);
- g_assert (gtk_source_completion_model_iter_last (model, &last_iter));
+ g_assert (gtk_source_completion_model_last_proposal (model, &last_iter));
- /* Get the last iter by another means, and compare it */
+ /* Get the last proposal by another means, and compare it */
nb_items = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (model), NULL);
g_assert (gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (model),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]