[anjuta] language-support-vala: port to GSettings



commit 099b8c53a3ed8b2170268234ef5182d8db3c4ceb
Author: Abderrahim Kitouni <a kitouni gmail com>
Date:   Thu Oct 21 23:37:16 2010 +0100

    language-support-vala: port to GSettings
    
    (also reenable the python loader, it doesn't use preferences)

 plugins/Makefile.am                         |    8 ++++----
 plugins/language-support-vala/plugin.vala   |    5 ++---
 plugins/language-support-vala/provider.vala |   16 ++++++++--------
 3 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 4060b8d..b17d8ef 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -34,9 +34,9 @@ SUBDIRS = . \
 	gbf-mkfile \
 	dir-project \
 	starter \
-	js-debugger
-#	language-support-js \
-#	language-support-vala \
-#	python-loader
+	js-debugger \
+	language-support-vala \
+	python-loader
+#	language-support-js
 
 -include $(top_srcdir)/git.mk
diff --git a/plugins/language-support-vala/plugin.vala b/plugins/language-support-vala/plugin.vala
index 623d9a2..02e0474 100644
--- a/plugins/language-support-vala/plugin.vala
+++ b/plugins/language-support-vala/plugin.vala
@@ -20,7 +20,7 @@ using Anjuta;
 
 public class ValaPlugin : Plugin {
 	internal weak IAnjuta.Editor current_editor;
-	internal Anjuta.Preferences prefs;
+	internal GLib.Settings settings = new GLib.Settings ("org.gnome.anjuta.cpp");
 	uint editor_watch_id;
 
 	Vala.CodeContext context;
@@ -43,7 +43,6 @@ public class ValaPlugin : Plugin {
 		context.report = report;
 		context.profile = Vala.Profile.GOBJECT;
 
-		prefs = shell.get_preferences ();
 		var project = (IAnjuta.ProjectManager) shell.get_object("IAnjutaProjectManager");
 		weak List<string> packages = project.get_packages();
 		add_package(context, "glib-2.0");
@@ -180,7 +179,7 @@ public class ValaPlugin : Plugin {
 	}
 
 	public void on_char_added (IAnjuta.EditorTip editor, Object position, char ch) {
-		if (!prefs.get_bool_with_default (ValaProvider.PREF_CALLTIP_ENABLE, true))
+		if (!settings.get_boolean (ValaProvider.PREF_CALLTIP_ENABLE))
 			return;
 
 		if (ch == '(') {
diff --git a/plugins/language-support-vala/provider.vala b/plugins/language-support-vala/provider.vala
index 4df90f3..9197cb3 100644
--- a/plugins/language-support-vala/provider.vala
+++ b/plugins/language-support-vala/provider.vala
@@ -23,10 +23,10 @@ public class ValaProvider : Object, IAnjuta.Provider {
 	static Regex member_access_split;
 	static Regex function_call;
 
-	const string PREF_AUTOCOMPLETE_ENABLE = "language.cpp.code.completion.enable";
-	const string PREF_SPACE_AFTER_FUNC = "language.cpp.code.completion.space.after.func";
-	const string PREF_BRACE_AFTER_FUNC = "language.cpp.code.completion.brace.after.func";
-	const string PREF_CALLTIP_ENABLE = "language.cpp.code.calltip.enable";
+	const string PREF_AUTOCOMPLETE_ENABLE = "cpp-completion-enable";
+	const string PREF_SPACE_AFTER_FUNC = "cpp-completion-space-after-func";
+	const string PREF_BRACE_AFTER_FUNC = "cpp-code-brace-after-func";
+	const string PREF_CALLTIP_ENABLE = "cpp-calltip-enable";
 
 	static construct {
 		try {
@@ -45,7 +45,7 @@ public class ValaProvider : Object, IAnjuta.Provider {
 		return "Vala";
 	}
 	public void populate (IAnjuta.Iterable iter) throws GLib.Error {
-		if (!plugin.prefs.get_bool_with_default (PREF_AUTOCOMPLETE_ENABLE, true))
+		if (!plugin.settings.get_boolean (PREF_AUTOCOMPLETE_ENABLE))
 			return;
 
 		var editor = plugin.current_editor as IAnjuta.EditorAssist;
@@ -99,12 +99,12 @@ public class ValaProvider : Object, IAnjuta.Provider {
 		}
 
 		if (is_func) {
-			if (plugin.prefs.get_bool_with_default (PREF_SPACE_AFTER_FUNC, true)) {
+			if (plugin.settings.get_boolean (PREF_SPACE_AFTER_FUNC)) {
 				assist += " ";
 			}
-			if (plugin.prefs.get_bool_with_default (PREF_BRACE_AFTER_FUNC, true)) {
+			if (plugin.settings.get_boolean (PREF_BRACE_AFTER_FUNC)) {
 				assist += "(";
-				if (plugin.prefs.get_bool_with_default (PREF_CALLTIP_ENABLE, true)) {
+				if (plugin.settings.get_boolean (PREF_CALLTIP_ENABLE)) {
 					calltip = true;
 				}
 			}



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