[gtksourceview/wip/completion-model: 17/19] Completion: select first proposal on "move-page"
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/completion-model: 17/19] Completion: select first proposal on "move-page"
- Date: Tue, 22 Jan 2013 16:35:53 +0000 (UTC)
commit 9195b540835a795a0058342cab51f087b6f77434
Author: SÃbastien Wilmet <swilmet gnome org>
Date: Tue Jan 22 14:33:29 2013 +0100
Completion: select first proposal on "move-page"
When we select another provider with Ctrl+left/right, the first proposal
is selected if needed.
gtksourceview/gtksourcecompletion.c | 72 ++++++++++++++++++-----------------
1 files changed, 37 insertions(+), 35 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index 42f5acb..bf00d5c 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -1376,6 +1376,41 @@ gtk_source_completion_move_cursor (GtkSourceCompletion *completion,
}
static void
+check_first_selected (GtkSourceCompletion *completion)
+{
+ GtkTreeSelection *selection;
+ GtkTreeIter piter;
+ GtkTreeIter first;
+ GtkTreeModel *model;
+
+ model = GTK_TREE_MODEL (completion->priv->model_proposals);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->tree_view_proposals));
+
+ if (!completion->priv->select_first)
+ {
+ return;
+ }
+
+ if (!gtk_tree_model_get_iter_first (model, &first))
+ {
+ return;
+ }
+
+ piter = first;
+
+ while (gtk_source_completion_model_iter_is_header (completion->priv->model_proposals, &piter))
+ {
+ if (!gtk_tree_model_iter_next (model, &piter))
+ {
+ return;
+ }
+ }
+
+ gtk_tree_selection_select_iter (selection, &piter);
+ scroll_to_iter (completion, &first);
+}
+
+static void
gtk_source_completion_move_page (GtkSourceCompletion *completion,
GtkScrollStep step,
gint num)
@@ -1407,6 +1442,8 @@ gtk_source_completion_move_page (GtkSourceCompletion *completion,
select_previous_provider (completion, -1 * num);
}
}
+
+ check_first_selected (completion);
}
static gboolean
@@ -2103,41 +2140,6 @@ gtk_source_completion_set_property (GObject *object,
}
static void
-check_first_selected (GtkSourceCompletion *completion)
-{
- GtkTreeSelection *selection;
- GtkTreeIter piter;
- GtkTreeIter first;
- GtkTreeModel *model;
-
- model = GTK_TREE_MODEL (completion->priv->model_proposals);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->tree_view_proposals));
-
- if (!completion->priv->select_first)
- {
- return;
- }
-
- if (!gtk_tree_model_get_iter_first (model, &first))
- {
- return;
- }
-
- piter = first;
-
- while (gtk_source_completion_model_iter_is_header (completion->priv->model_proposals, &piter))
- {
- if (!gtk_tree_model_iter_next (model, &piter))
- {
- return;
- }
- }
-
- gtk_tree_selection_select_iter (selection, &piter);
- scroll_to_iter (completion, &first);
-}
-
-static void
gtk_source_completion_hide_default (GtkSourceCompletion *completion)
{
gtk_label_set_markup (GTK_LABEL (completion->priv->default_info), "");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]