Commit 099b8c53 authored by Abderrahim Kitouni's avatar Abderrahim Kitouni Committed by Johannes Schmid

language-support-vala: port to GSettings

(also reenable the python loader, it doesn't use preferences)
parent d03876ec
......@@ -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
......@@ -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 == '(') {
......
......@@ -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;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment