[gtksourceview/wip/completion-model: 7/19] Completion: use a new model for each population
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/completion-model: 7/19] Completion: use a new model for each population
- Date: Tue, 22 Jan 2013 16:35:03 +0000 (UTC)
commit d96cf37049f3fd17468dd7db6f7f9185109dddf4
Author: SÃbastien Wilmet <swilmet gnome org>
Date: Sun Jan 20 21:37:54 2013 +0100
Completion: use a new model for each population
At the beginning of a population, we remove the model from the TreeView,
and we destroy it. A new model is created, which is set to the TreeView
only when the population is finished.
When the population is finished, we must also show the completion
window, which is normally done in on_row_inserted_cb(), but the
"row-inserted" signals are not emitted.
gtksourceview/gtksourcecompletion.c | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index aa846a7..0571f51 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -3154,6 +3154,14 @@ update_completion (GtkSourceCompletion *completion,
completion->priv->select_on_show &&
(!get_selected_proposal (completion, NULL, NULL, NULL) || completion->priv->select_first);
+ /* Create a new CompletionModel */
+ gtk_tree_view_set_model (GTK_TREE_VIEW (completion->priv->tree_view_proposals), NULL);
+ g_object_unref (completion->priv->model_proposals);
+ completion->priv->model_proposals = gtk_source_completion_model_new ();
+
+ gtk_source_completion_model_set_show_headers (completion->priv->model_proposals,
+ completion->priv->show_headers);
+
gtk_source_completion_model_begin_populate (completion->priv->model_proposals,
completion->priv->active_providers);
@@ -3192,8 +3200,34 @@ populating_done (GtkSourceCompletion *completion,
}
else
{
+ gtk_tree_view_set_model (GTK_TREE_VIEW (completion->priv->tree_view_proposals),
+ GTK_TREE_MODEL (completion->priv->model_proposals));
+
update_selection_label (completion);
+ if (!gtk_widget_get_visible (completion->priv->window))
+ {
+ if (!completion->priv->remember_info_visibility)
+ {
+ completion->priv->info_visible = FALSE;
+ }
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (completion->priv->info_button),
+ completion->priv->info_visible);
+
+ DEBUG({
+ g_print ("Emitting show\n");
+ });
+
+ g_signal_emit (completion, signals[SHOW], 0);
+ }
+ else
+ {
+ DEBUG({
+ g_print ("Already visible\n");
+ });
+ }
+
if (completion->priv->select_on_show)
{
/* CHECK: does this actually work? */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]