[gnome-builder] vala: add preference to disable vala warnings



commit 5ca15b4dff32022b90e9e3f542355b913e64ffe7
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jan 28 14:51:57 2016 +0100

    vala: add preference to disable vala warnings
    
    Until we sort out the build system stuff, this can be pretty annoying.

 plugins/vala-pack/Makefile.am                     |    2 +
 plugins/vala-pack/ide-vala-preferences-addin.vala |   43 +++++++++++++++++++++
 plugins/vala-pack/vala-pack-plugin.vala           |    1 +
 po/POTFILES.in                                    |    1 +
 4 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/plugins/vala-pack/Makefile.am b/plugins/vala-pack/Makefile.am
index e47a235..6457edb 100644
--- a/plugins/vala-pack/Makefile.am
+++ b/plugins/vala-pack/Makefile.am
@@ -16,6 +16,7 @@ libvala_pack_plugin_la_SOURCES = \
        ide-vala-indenter.vala \
        ide-vala-index.vala \
        ide-vala-locator.vala \
+       ide-vala-preferences-addin.vala \
        ide-vala-source-file.vala \
        ide-vala-symbol-resolver.vala \
        ide-vala-symbol-tree.vala \
@@ -37,6 +38,7 @@ libvala_pack_plugin_la_VALAFLAGS = \
 
 libvala_pack_plugin_la_CFLAGS = \
        -DG_LOG_DOMAIN=\"vala-pack-plugin\" \
+       -DGETTEXT_PACKAGE=\"gnome-builder\" \
        $(LIBIDE_CFLAGS) \
        $(VALA_CFLAGS) \
        -I$(top_srcdir)/libide \
diff --git a/plugins/vala-pack/ide-vala-preferences-addin.vala 
b/plugins/vala-pack/ide-vala-preferences-addin.vala
new file mode 100644
index 0000000..9919261
--- /dev/null
+++ b/plugins/vala-pack/ide-vala-preferences-addin.vala
@@ -0,0 +1,43 @@
+/* ide-vala-preferences-addin.vala
+ *
+ * Copyright (C) 2016 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+using GLib;
+using Ide;
+
+namespace Ide {
+       public class ValaPreferencesAddin: GLib.Object, Ide.PreferencesAddin {
+               uint enabled_switch;
+
+               public void load (Ide.Preferences preferences) {
+                       this.enabled_switch = preferences.add_switch ("code-insight",
+                                                                     "diagnostics",
+                                                                     "org.gnome.builder.extension-type",
+                                                                     "enabled",
+                                                                     
"/org/gnome/builder/extension-types/vala-pack-plugin/IdeDiagnosticProvider/",
+                                                                     null,
+                                                                     _("Vala"),
+                                                                     _("Show errors and warnings provided by 
Vala"),
+                                                                     _("vala diagnostics warnings errors"),
+                                                                     100);
+               }
+
+               public void unload (Ide.Preferences preferences) {
+                       /* TODO: preferences.remove (self.enabled_switch); */
+               }
+       }
+}
diff --git a/plugins/vala-pack/vala-pack-plugin.vala b/plugins/vala-pack/vala-pack-plugin.vala
index b8553f9..59593d1 100644
--- a/plugins/vala-pack/vala-pack-plugin.vala
+++ b/plugins/vala-pack/vala-pack-plugin.vala
@@ -28,6 +28,7 @@ public void peas_register_types (GLib.TypeModule module)
        peas.register_extension_type (typeof (Ide.CompletionProvider), typeof (Ide.ValaCompletionProvider));
        peas.register_extension_type (typeof (Ide.DiagnosticProvider), typeof (Ide.ValaDiagnosticProvider));
        peas.register_extension_type (typeof (Ide.Indenter), typeof (Ide.ValaIndenter));
+       peas.register_extension_type (typeof (Ide.PreferencesAddin), typeof (Ide.ValaPreferencesAddin));
        peas.register_extension_type (typeof (Ide.Service), typeof (Ide.ValaService));
        peas.register_extension_type (typeof (Ide.SymbolResolver), typeof (Ide.ValaSymbolResolver));
 }
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 846731a..c29f1bf 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -103,3 +103,4 @@ plugins/terminal/gb-terminal-view-actions.c
 plugins/terminal/gb-terminal-workbench-addin.c
 [type: gettext/glade]plugins/terminal/gtk/menus.ui
 plugins/todo/todo_plugin/__init__.py
+plugins/vala-pack/ide-vala-preferences-addin.vala


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