[anjuta] resolve dependencies from cpp-java plugin
- From: Abderrahim Kitouni <akitouni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] resolve dependencies from cpp-java plugin
- Date: Sat, 23 Jun 2012 18:36:48 +0000 (UTC)
commit 15f9844449809a4d36534f22decd408e526e8dab
Author: Moritz LÃdecke <ritze skweez net>
Date: Fri Jun 22 15:20:32 2012 +0200
resolve dependencies from cpp-java plugin
the vala plugin shows it own option widget now
https://bugzilla.gnome.org/show_bug.cgi?id=678551
plugins/language-support-vala/Makefile.am | 22 ++-
plugins/language-support-vala/anjuta-vala.png | Bin 0 -> 4218 bytes
plugins/language-support-vala/anjuta-vala.ui | 209 ++++++++++++++++++++
plugins/language-support-vala/config.vapi | 5 +
.../org.gnome.anjuta.plugins.vala.gschema.xml.in | 19 ++
plugins/language-support-vala/plugin.vala | 41 ++++-
6 files changed, 292 insertions(+), 4 deletions(-)
---
diff --git a/plugins/language-support-vala/Makefile.am b/plugins/language-support-vala/Makefile.am
index 3bf7273..dc56973 100644
--- a/plugins/language-support-vala/Makefile.am
+++ b/plugins/language-support-vala/Makefile.am
@@ -1,5 +1,13 @@
if ENABLE_VALA
+#Plugin glade file
+vala_gladedir = $(anjuta_glade_dir)
+vala_glade_DATA = anjuta-vala.ui
+
+# Plugin Icon file
+vala_pixmapsdir = $(anjuta_image_dir)
+vala_pixmaps_DATA = anjuta-vala.png
+
# Plugin description file
plugin_in_files = anjuta-vala.plugin.in
%.plugin: %.plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache
@@ -36,7 +44,7 @@ plugindir = $(anjuta_plugin_dir)
plugin_LTLIBRARIES = libanjuta-language-vala.la
# Plugin sources
-libanjuta_language_vala_la_VALASOURCES = locator.vala plugin.vala provider.vala report.vala
+libanjuta_language_vala_la_VALASOURCES = config.vapi locator.vala plugin.vala provider.vala report.vala
nodist_libanjuta_language_vala_la_SOURCES = $(libanjuta_language_vala_la_VALASOURCES:.vala=.c)
CLEANFILES = $(nodist_libanjuta_language_vala_la_SOURCES) libanjuta_language_vala_la_vala.stamp
@@ -44,7 +52,7 @@ locator.c plugin.c provider.c report.c: libanjuta_language_vala_la_vala.stamp
@true
libanjuta_language_vala_la_vala.stamp: $(libanjuta_language_vala_la_VALASOURCES)
- valac $(VALAFLAGS) --vapidir $(srcdir) --pkg $(LIBVALA) --pkg libanjuta-3.0 -C $^
+ valac $(VALAFLAGS) --vapidir $(srcdir) --pkg $(LIBVALA) --pkg libanjuta-3.0 --pkg gtk+-3.0 -C $^
touch $@
libanjuta_language_vala_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
@@ -56,13 +64,23 @@ libanjuta_language_vala_la_LIBADD = \
endif # ENABLE_VALA
+gsettings_in_file = org.gnome.anjuta.plugins.vala.gschema.xml.in
+gsettings_SCHEMAS = $(gsettings_in_file:.xml.in=.xml)
+ INTLTOOL_XML_NOMERGE_RULE@
+ GSETTINGS_RULES@
+
EXTRA_DIST = \
$(plugin_in_files) \
$(vala_plugin_DATA) \
+ $(vala_pixmaps_DATA) \
+ $(vala_glade_DATA) \
+ $(gsettings_in_file) \
$(libanjuta_language_vala_la_VALASOURCES) \
libanjuta-3.0.deps \
libanjuta-3.0.vapi
+CLEANFILES = \
+ $(gsettings_SCHEMAS)
-include $(top_srcdir)/git.mk
diff --git a/plugins/language-support-vala/anjuta-vala.png b/plugins/language-support-vala/anjuta-vala.png
new file mode 100644
index 0000000..0fe99c5
Binary files /dev/null and b/plugins/language-support-vala/anjuta-vala.png differ
diff --git a/plugins/language-support-vala/anjuta-vala.ui b/plugins/language-support-vala/anjuta-vala.ui
new file mode 100644
index 0000000..7623d6d
--- /dev/null
+++ b/plugins/language-support-vala/anjuta-vala.ui
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-requires anjuta 0.0 -->
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="upper">100</property>
+ <property name="value">4</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment3">
+ <property name="upper">50</property>
+ <property name="value">10</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment4">
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkListStore" id="liststore1"/>
+ <object class="GtkWindow" id="preferences_dialog">
+ <property name="can_focus">False</property>
+ <property name="title" translatable="yes">window1</property>
+ <child>
+ <object class="GtkVBox" id="preferences">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <child>
+ <object class="GtkFrame" id="frame45">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkVBox" id="vbox1118">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="preferences:completion-enable">
+ <property name="label" translatable="yes">Enable code completion</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="border_width">5</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="preferences:completion-space-after-func">
+ <property name="label" translatable="yes">Add a space after function call autocompletion</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="border_width">5</property>
+ <property name="use_action_appearance">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="preferences:completion-brace-after-func">
+ <property name="label" translatable="yes">Add '(' after function call autocompletion</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="border_width">5</property>
+ <property name="use_action_appearance">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label_item">
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label12334">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Autocompletion</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="border_width">5</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <child>
+ <object class="GtkCheckButton" id="preferences:calltip-enable">
+ <property name="label" translatable="yes">Show calltips</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="border_width">5</property>
+ <property name="use_action_appearance">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="label" translatable="yes">Calltips</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/plugins/language-support-vala/config.vapi b/plugins/language-support-vala/config.vapi
new file mode 100644
index 0000000..86ab8d4
--- /dev/null
+++ b/plugins/language-support-vala/config.vapi
@@ -0,0 +1,5 @@
+[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
+namespace Config {
+ public const string GETTEXT_PACKAGE;
+ public const string PACKAGE_DATA_DIR;
+}
diff --git a/plugins/language-support-vala/org.gnome.anjuta.plugins.vala.gschema.xml.in b/plugins/language-support-vala/org.gnome.anjuta.plugins.vala.gschema.xml.in
new file mode 100644
index 0000000..4da4fb8
--- /dev/null
+++ b/plugins/language-support-vala/org.gnome.anjuta.plugins.vala.gschema.xml.in
@@ -0,0 +1,19 @@
+<schemalist>
+ <schema id="org.gnome.anjuta.plugins.vala" path="/org/gnome/anjuta/plugins/vala/">
+ <key name="user-packages" type="s">
+ <default>""</default>
+ </key>
+ <key name="completion-enable" type="b">
+ <default>true</default>
+ </key>
+ <key name="completion-space-after-func" type="b">
+ <default>true</default>
+ </key>
+ <key name="completion-brace-after-func" type="b">
+ <default>true</default>
+ </key>
+ <key name="calltip-enable" type="b">
+ <default>true</default>
+ </key>
+ </schema>
+</schemalist>
diff --git a/plugins/language-support-vala/plugin.vala b/plugins/language-support-vala/plugin.vala
index 757d104..a9a2c58 100644
--- a/plugins/language-support-vala/plugin.vala
+++ b/plugins/language-support-vala/plugin.vala
@@ -16,11 +16,18 @@
*/
using GLib;
+using Gtk;
using Anjuta;
-public class ValaPlugin : Plugin {
+public class ValaPlugin : Plugin, IAnjuta.Preferences {
+ internal const string PREF_WIDGET_SPACE = "preferences:completion-space-after-func";
+ internal const string PREF_WIDGET_BRACE = "preferences:completion-brace-after-func";
+ internal const string PREF_WIDGET_AUTO = "preferences:completion-enable";
+ internal const string ICON_FILE = "anjuta-vala.png";
+ internal static string PREFS_BUILDER = Config.PACKAGE_DATA_DIR + "/glade/anjuta-vala.ui";
+
internal weak IAnjuta.Editor current_editor;
- internal GLib.Settings settings = new GLib.Settings ("org.gnome.anjuta.plugins.cpp");
+ internal GLib.Settings settings = new GLib.Settings ("org.gnome.anjuta.plugins.vala");
uint editor_watch_id;
ulong project_loaded_id;
@@ -34,6 +41,8 @@ public class ValaPlugin : Plugin {
Vala.Parser parser;
Vala.Genie.Parser genie_parser;
+ public static Gtk.Builder bxml;
+
Vala.Set<string> current_sources = new Vala.HashSet<string> (str_hash, str_equal);
ValaPlugin () {
Object ();
@@ -625,6 +634,34 @@ public class ValaPlugin : Plugin {
report.update_errors(current_editor);
}
}
+
+ private void on_autocompletion_toggled (ToggleButton button) {
+ var sensitive = button.get_active();
+ Gtk.Widget widget = bxml.get_object (PREF_WIDGET_SPACE) as Widget;
+ widget.set_sensitive (sensitive);
+ widget = bxml.get_object (PREF_WIDGET_BRACE) as Widget;
+ widget.set_sensitive (sensitive);
+ }
+
+ public void merge (Anjuta.Preferences prefs) throws GLib.Error {
+ bxml = new Builder();
+
+ /* Add preferences */
+ try {
+ bxml.add_from_file (PREFS_BUILDER);
+ } catch (Error err) {
+ warning ("Couldn't load builder file: %s", err.message);
+ }
+ prefs.add_from_builder (bxml, settings, "preferences", _("Auto-complete"),
+ ICON_FILE);
+ var toggle = bxml.get_object (PREF_WIDGET_AUTO) as ToggleButton;
+ toggle.toggled.connect (on_autocompletion_toggled);
+ on_autocompletion_toggled (toggle);
+ }
+
+ public void unmerge (Anjuta.Preferences prefs) throws GLib.Error {
+ prefs.remove_page (_("Auto-complete"));
+ }
}
[ModuleInit]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]