[libpeas] Add a sample vala plugin.
- From: Steve Frécinaux <sfre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Add a sample vala plugin.
- Date: Sun, 6 Mar 2011 16:10:49 +0000 (UTC)
commit 0a6d215f42c82be9cb69c81165abbc1b7e5cc418
Author: Steve Frécinaux <code istique net>
Date: Sun Mar 6 17:10:14 2011 +0100
Add a sample vala plugin.
https://bugzilla.gnome.org/show_bug.cgi?id=622664
.gitignore | 1 +
configure.ac | 32 ++++++++++++-
peas-demo/plugins/Makefile.am | 4 ++
peas-demo/plugins/valahello/Makefile.am | 22 +++++++++
.../valahello/peasdemo-vala-hello-plugin.vala | 49 ++++++++++++++++++++
peas-demo/plugins/valahello/valahello.plugin | 7 +++
6 files changed, 114 insertions(+), 1 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 768a5c3..70d75ad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,6 +51,7 @@ Makefile.in
/missing
/mkinstalldirs
/omf.make
+/peas-demo/plugins/valahello/peasdemo-vala-hello-plugin.c
/po/*.header
/po/*.gmo
/po/*.mo
diff --git a/configure.ac b/configure.ac
index 66c5003..1efe241 100644
--- a/configure.ac
+++ b/configure.ac
@@ -317,7 +317,7 @@ else
dnl it's not required for building libpeas, merely to use it properly.
fi
-if test "$enable_python" = "yes" -a "$found_python" = "no"; then
+if test "$enable_python" = "yes" -a "$found_python" != "yes"; then
AC_MSG_ERROR([$found_python])
fi
@@ -336,6 +336,34 @@ fi
AM_CONDITIONAL([ENABLE_PYTHON],[test "$found_python" = "yes"])
dnl ================================================================
+dnl Vala
+dnl ================================================================
+
+VALA_REQUIRED=0.11.1
+
+AC_ARG_ENABLE([vala],
+ AS_HELP_STRING([--enable-vala],[Enable Vala support]),
+ [enable_vala=$enableval],
+ [enable_vala=auto])
+
+if test "$enable_vala" = "no"; then
+ found_vala="no (disabled, use --enable-vala to enable)"
+else
+ AM_PROG_VALAC($VALA_REQUIRED)
+ if test "$VALAC" = ""; then
+ found_vala="no (valac >= $VALA_REQUIRED not found)"
+ else
+ found_vala="yes"
+ fi
+fi
+
+if test "$enable_vala" = "yes" -a "$found_vala" != "yes"; then
+ AC_MSG_ERROR([$found_vala])
+fi
+
+AM_CONDITIONAL([ENABLE_VALA],[test "$found_vala" = "yes"])
+
+dnl ================================================================
dnl Documentation
dnl ================================================================
@@ -398,6 +426,7 @@ peas-demo/plugins/helloworld/Makefile
peas-demo/plugins/pythonhello/Makefile
peas-demo/plugins/secondtime/Makefile
peas-demo/plugins/seedhello/Makefile
+peas-demo/plugins/valahello/Makefile
po/Makefile.in
tests/Makefile
tests/libpeas/Makefile
@@ -435,4 +464,5 @@ Configuration:
Glade Catalog : ${found_glade_catalog}
Seed JS support : ${found_seed}
Python support : ${found_python}
+ Vala support : ${found_vala}
"
diff --git a/peas-demo/plugins/Makefile.am b/peas-demo/plugins/Makefile.am
index d2824e1..37ca9db 100644
--- a/peas-demo/plugins/Makefile.am
+++ b/peas-demo/plugins/Makefile.am
@@ -7,3 +7,7 @@ endif
if ENABLE_SEED
SUBDIRS += seedhello
endif
+
+if ENABLE_VALA
+SUBDIRS += valahello
+endif
diff --git a/peas-demo/plugins/valahello/Makefile.am b/peas-demo/plugins/valahello/Makefile.am
new file mode 100644
index 0000000..e381653
--- /dev/null
+++ b/peas-demo/plugins/valahello/Makefile.am
@@ -0,0 +1,22 @@
+plugindir = $(libdir)/peas-demo/plugins/valahello
+
+INCLUDES = \
+ -I$(top_srcdir) \
+ $(PEAS_CFLAGS) \
+ $(PEAS_GTK_CFLAGS)
+
+VALAFLAGS = \
+ --girdir $(top_builddir)/libpeas \
+ --girdir $(top_builddir)/libpeas-gtk \
+ --pkg PeasGtk-1.0 --pkg gtk+-3.0
+
+plugin_LTLIBRARIES = libvalahello.la
+
+libvalahello_la_SOURCES = peasdemo-vala-hello-plugin.vala
+
+libvalahello_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
+libvalahello_la_LIBADD = $(PEAS_LIBS) $(PEAS_GTK_LIBS)
+
+plugin_DATA = valahello.plugin
+
+EXTRA_DIST = $(plugin_DATA)
diff --git a/peas-demo/plugins/valahello/peasdemo-vala-hello-plugin.vala b/peas-demo/plugins/valahello/peasdemo-vala-hello-plugin.vala
new file mode 100644
index 0000000..7b1906a
--- /dev/null
+++ b/peas-demo/plugins/valahello/peasdemo-vala-hello-plugin.vala
@@ -0,0 +1,49 @@
+namespace PeasDemo {
+ public class ValaHelloPlugin : Peas.ExtensionBase, Peas.Activatable {
+ private Gtk.Widget label;
+ public Object object { get; construct; }
+
+ public ValaHelloPlugin () {
+ Object ();
+ }
+
+ public void activate () {
+ var window = object as Gtk.Window;
+
+ label = new Gtk.Label ("Hello World from Vala!");
+ var box = window.get_child () as Gtk.Box;
+ box.pack_start (label);
+ label.show ();
+ }
+
+ public void deactivate () {
+ var window = object as Gtk.Window;
+
+ var box = window.get_child () as Gtk.Box;
+ box.remove (label);
+ }
+
+ public void update_state () {
+ }
+ }
+
+ public class ValaPluginConfig : Peas.ExtensionBase, PeasGtk.Configurable {
+ public ValaPluginConfig () {
+ Object ();
+ }
+
+ public Gtk.Widget create_configure_widget () {
+ string text = "This is a configuration dialog for the ValaHello plugin.";
+ return new Gtk.Label (text);
+ }
+ }
+}
+
+[ModuleInit]
+public void peas_register_types (GLib.TypeModule module) {
+ var objmodule = module as Peas.ObjectModule;
+ objmodule.register_extension_type (typeof (Peas.Activatable),
+ typeof (PeasDemo.ValaHelloPlugin));
+ objmodule.register_extension_type (typeof (PeasGtk.Configurable),
+ typeof (PeasDemo.ValaPluginConfig));
+}
diff --git a/peas-demo/plugins/valahello/valahello.plugin b/peas-demo/plugins/valahello/valahello.plugin
new file mode 100644
index 0000000..281b9c7
--- /dev/null
+++ b/peas-demo/plugins/valahello/valahello.plugin
@@ -0,0 +1,7 @@
+[Plugin]
+Module=valahello
+IAge=2
+Name=Vala also says Hello
+Description=Inserts a box containing "Hello World" in every window.
+Authors=Abderrahim Kitouni <a kitouni gmail com>
+Copyright=Copyright © 2010 Abderrahim Kitouni
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]