[latexila] Completion: dynamic get_activation()



commit 69449d1b00e1d980a36ec64e7024bc2a6d4bf31a
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Mar 16 16:36:31 2013 +0100

    Completion: dynamic get_activation()
    
    It is now supported in GtkSourceView.

 configure.ac        |    2 +-
 src/completion.vala |   17 +++++++----------
 2 files changed, 8 insertions(+), 11 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f1ea84d..d8c33a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -26,7 +26,7 @@ LT_INIT
 # Required dependencies versions
 GLIB_REQUIRED_VERSION="2.32"
 GTK_REQUIRED_VERSION="3.6.0"
-GTKSOURCEVIEW_REQUIRED_VERSION="3.7.3"
+GTKSOURCEVIEW_REQUIRED_VERSION="3.7.92"
 VALA_REQUIRED_VERSION="0.19.0"
 
 AC_SUBST([GLIB_REQUIRED_VERSION])
diff --git a/src/completion.vala b/src/completion.vala
index 08b428e..f897484 100644
--- a/src/completion.vala
+++ b/src/completion.vala
@@ -107,11 +107,12 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
 
     public SourceCompletionActivation get_activation ()
     {
-        // This function is called only once, so if we disable interactive
-        // completion here, there would be a problem because in this case,
-        // if the user enables the option, it will take effect only on restart.
-        return SourceCompletionActivation.USER_REQUESTED
-            | SourceCompletionActivation.INTERACTIVE;
+        var activation = SourceCompletionActivation.USER_REQUESTED;
+
+        if (_settings.get_boolean ("interactive-completion"))
+            activation |= SourceCompletionActivation.INTERACTIVE;
+
+        return activation;
     }
 
     public bool match (SourceCompletionContext context)
@@ -123,11 +124,7 @@ public class CompletionProvider : GLib.Object, SourceCompletionProvider
         if (buf.has_selection)
             return false;
 
-        if (is_user_request (context))
-            return true;
-
-        // Since get_activation() is not dynamic, we do that here.
-        return _settings.get_boolean ("interactive-completion");
+        return true;
     }
 
     /*************************************************************************/


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