[gtksourceview] Completion: hide window after proposal activation



commit 025b84e25b6c54059650b9d8dd798e3949f27be2
Author: SÃbastien Wilmet <swilmet gnome org>
Date:   Sat Feb 16 21:25:12 2013 +0100

    Completion: hide window after proposal activation
    
    Since the interactive completion is blocked during the proposal
    activation, the window can not reappear. So it's simpler to hide the
    window after the proposal activation.

 gtksourceview/gtksourcecompletion.c |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/gtksourceview/gtksourcecompletion.c b/gtksourceview/gtksourcecompletion.c
index b4b6b3d..0329761 100644
--- a/gtksourceview/gtksourcecompletion.c
+++ b/gtksourceview/gtksourcecompletion.c
@@ -292,8 +292,6 @@ gtk_source_completion_activate_proposal (GtkSourceCompletion *completion)
 {
        GtkSourceCompletionProvider *provider = NULL;
        GtkSourceCompletionProposal *proposal = NULL;
-       gboolean has_start;
-       GtkTextIter start_iter;
        GtkTextIter insert_iter;
        gboolean activated;
 
@@ -302,19 +300,6 @@ gtk_source_completion_activate_proposal (GtkSourceCompletion *completion)
                g_return_if_reached ();
        }
 
-       has_start = gtk_source_completion_provider_get_start_iter (provider,
-                                                                  completion->priv->context,
-                                                                  proposal,
-                                                                  &start_iter);
-
-       /* First hide the completion because the activation might actually
-          activate another one, which we don't want to hide */
-       DEBUG({
-               g_print ("Hiding just before proposal activation\n");
-       });
-
-       gtk_source_completion_hide (completion);
-
        get_iter_at_insert (completion, &insert_iter);
 
        gtk_source_completion_block_interactive (completion);
@@ -323,9 +308,15 @@ gtk_source_completion_activate_proposal (GtkSourceCompletion *completion)
 
        if (!activated)
        {
+               GtkTextIter start_iter;
                GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (completion->priv->view));
                gchar *text = gtk_source_completion_proposal_get_text (proposal);
 
+               gboolean has_start = gtk_source_completion_provider_get_start_iter (provider,
+                                                                                   completion->priv->context,
+                                                                                   proposal,
+                                                                                   &start_iter);
+
                if (has_start)
                {
                        gtk_text_buffer_begin_user_action (buffer);
@@ -343,6 +334,8 @@ gtk_source_completion_activate_proposal (GtkSourceCompletion *completion)
 
        gtk_source_completion_unblock_interactive (completion);
 
+       gtk_source_completion_hide (completion);
+
        g_object_unref (provider);
        g_object_unref (proposal);
 }


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