[anjuta] language-support-cpp-java: Allow to really disable autocompletion in the preferences



commit cd24b8fc7c89fbd50865edfe01312fcbd24f7d8c
Author: Johannes Schmid <jhs gnome org>
Date:   Fri May 14 11:57:01 2010 +0200

    language-support-cpp-java: Allow to really disable autocompletion in the preferences

 .gitignore                                         |   66 +++++++++++++++++++-
 .../language-support-cpp-java/cpp-java-assist.c    |   35 ++++++++--
 2 files changed, 93 insertions(+), 8 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a92530c..9ecf5ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,14 +36,78 @@
 /intltool-update
 /intltool-update.in
 /libtool
-/po/*.gmo
 /po/*.mo
 /po/.intltool-merge-cache
 /po/Makefile
 /po/Makefile.in
 /po/Makefile.in.in
 /po/POTFILES
+/po/ar.gmo
+/po/az.gmo
+/po/be.gmo
+/po/be latin gmo
+/po/bg.gmo
+/po/ca.gmo
+/po/ca valencia gmo
+/po/cs.gmo
+/po/da.gmo
+/po/de.gmo
+/po/dz.gmo
+/po/el.gmo
+/po/en shaw gmo
+/po/en_CA.gmo
+/po/en_GB.gmo
+/po/es.gmo
+/po/eu.gmo
+/po/fi.gmo
+/po/fr.gmo
+/po/ga.gmo
+/po/gl.gmo
+/po/gu.gmo
+/po/he.gmo
+/po/hi.gmo
+/po/hr.gmo
+/po/hu.gmo
+/po/id.gmo
+/po/it.gmo
+/po/ja.gmo
+/po/kn.gmo
+/po/ko.gmo
+/po/lt.gmo
+/po/lv.gmo
+/po/mai.gmo
+/po/mk.gmo
+/po/ml.gmo
+/po/mr.gmo
+/po/ms.gmo
+/po/nb.gmo
+/po/ne.gmo
+/po/nl.gmo
+/po/oc.gmo
+/po/or.gmo
+/po/pa.gmo
+/po/pl.gmo
+/po/pt.gmo
+/po/pt_BR.gmo
+/po/ro.gmo
+/po/ru.gmo
+/po/rw.gmo
+/po/si.gmo
+/po/sk.gmo
+/po/sl.gmo
+/po/sq.gmo
+/po/sr.gmo
+/po/sr latin gmo
 /po/stamp-it
+/po/sv.gmo
+/po/te.gmo
+/po/th.gmo
+/po/tr.gmo
+/po/uk.gmo
+/po/vi.gmo
+/po/zh_CN.gmo
+/po/zh_HK.gmo
+/po/zh_TW.gmo
 /so_locations
 /stamp-h1
 /tags
diff --git a/plugins/language-support-cpp-java/cpp-java-assist.c b/plugins/language-support-cpp-java/cpp-java-assist.c
index 598947c..741f566 100644
--- a/plugins/language-support-cpp-java/cpp-java-assist.c
+++ b/plugins/language-support-cpp-java/cpp-java-assist.c
@@ -1154,6 +1154,22 @@ cpp_java_assist_calltip (CppJavaAssist *assist)
 	g_object_unref (iter);
 	return FALSE;
 }
+/**
+ * cpp_java_assist_none:
+ * @self: IAnjutaProvider object
+ * @assist: CppJavaAssist object
+ *
+ * Indicate that there is nothing to autocomplete
+ */
+static void
+cpp_java_assist_none (IAnjutaProvider* self,
+                      CppJavaAssist* assist)
+{
+	ianjuta_editor_assist_proposals (assist->priv->iassist,
+	                                 self,
+	                                 NULL, TRUE, NULL);
+}
+
 
 /**
  * cpp_java_assist_populate:
@@ -1165,16 +1181,23 @@ static void
 cpp_java_assist_populate (IAnjutaProvider* self, IAnjutaIterable* cursor, GError** e)
 {
 	CppJavaAssist* assist = CPP_JAVA_ASSIST (self);
-
+	
+	/* Check if we actually want autocompletion at all */
+	if (!anjuta_preferences_get_bool_with_default (anjuta_preferences_default (),
+	                                               PREF_AUTOCOMPLETE_ENABLE,
+	                                               TRUE))
+	{
+		cpp_java_assist_none (self, assist);
+		return;
+	}
+	
 	/* Check if this is a valid text region for completion */
 	IAnjutaEditorAttribute attrib = ianjuta_editor_cell_get_attribute (IANJUTA_EDITOR_CELL(cursor),
 	                                                                   NULL);
 	if (attrib == IANJUTA_EDITOR_STRING ||
 	    attrib == IANJUTA_EDITOR_COMMENT)
 	{
-		ianjuta_editor_assist_proposals (assist->priv->iassist,
-		                                 IANJUTA_PROVIDER(self),
-		                                 NULL, TRUE, NULL);
+		cpp_java_assist_none (self, assist);
 		return;
 	}
 
@@ -1228,9 +1251,7 @@ cpp_java_assist_populate (IAnjutaProvider* self, IAnjutaIterable* cursor, GError
 		g_object_unref (assist->priv->start_iter);
 		assist->priv->start_iter = NULL;
 	}
-	ianjuta_editor_assist_proposals (assist->priv->iassist,
-	                                 IANJUTA_PROVIDER(self),
-	                                 NULL, TRUE, NULL);
+	cpp_java_assist_none (self, assist);
 } 
 
 /**



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