[totem] plugins: Re-add the sample vala plugin



commit ea1025b95bec71a1bc5b5af1c93e34801b24fd46
Author: Abderrahim Kitouni <a kitouni gmail com>
Date:   Wed Dec 15 20:45:22 2010 +0100

    plugins: Re-add the sample vala plugin
    
    https://bugzilla.gnome.org/show_bug.cgi?id=623247
    
    Note that you might need newer versions of gtk+ and gdk-pixbuf
    for this to work.

 configure.in                                       |   33 +++++++++++++++++++-
 src/Makefile.am                                    |    3 +-
 src/plugins/sample-vala/Makefile.am                |   24 ++++++++++++++
 src/plugins/sample-vala/sample-vala.plugin.in      |    8 +++++
 .../sample-vala/totem-sample-vala-plugin.vala      |   23 ++++++++++++++
 5 files changed, 89 insertions(+), 2 deletions(-)
---
diff --git a/configure.in b/configure.in
index ebd26f0..94079d5 100644
--- a/configure.in
+++ b/configure.in
@@ -47,6 +47,7 @@ GTK_REQS=2.91.7
 TOTEM_PLPARSER_REQS=2.29.1
 GNOMEICON_REQS=2.15.90
 DBUS_REQS=0.82
+VALA_REQS=0.11.1
 PEAS_REQS=0.7.0
 PYTHON_REQS=2.3
 PYGOBJECT_REQS=2.27.0
@@ -67,7 +68,7 @@ AC_SUBST(TOTEM_API_VERSION)
 AC_DEFINE_UNQUOTED(TOTEM_API_VERSION, ["$TOTEM_API_VERSION"], [Define to the Totem plugin API version])
 
 # The full list of plugins
-allowed_plugins="bemused brasero-disc-recorder chapters coherence_upnp dbus-service galago gromit iplayer jamendo lirc media-player-keys ontop opensubtitles properties publish pythonconsole save-file sample-python screensaver screenshot sidebar-test skipto thumbnail tracker youtube"
+allowed_plugins="bemused brasero-disc-recorder chapters coherence_upnp dbus-service galago gromit iplayer jamendo lirc media-player-keys ontop opensubtitles properties publish pythonconsole save-file sample-python sample-vala screensaver screenshot sidebar-test skipto thumbnail tracker youtube"
 
 PLUGINDIR='${libdir}/totem/plugins'
 AC_SUBST(PLUGINDIR)
@@ -316,6 +317,29 @@ fi
 
 AM_CONDITIONAL([ENABLE_PYTHON],[test "x$enable_python" = "xyes"])
 
+dnl ================================================================
+dnl Vala plugins
+dnl ================================================================
+AC_MSG_CHECKING([whether Vala plugin support is requested])
+AC_ARG_ENABLE([vala],
+	AS_HELP_STRING([--enable-vala],[Enable Vala plugin support]),
+	[enable_vala=$enableval],
+	[enable_vala=auto])
+AC_MSG_RESULT([$enable_vala])
+if test "x$enable_vala" != "xno"; then
+	AM_PROG_VALAC([$VALA_REQS])
+	if test "x$VALAC" = "x"; then
+		if test "x$enable_vala" = "xyes"; then
+			AC_MSG_ERROR([Vala plugin support explicitly requested, but not found])
+		fi
+		with_vala=no
+	else
+		with_vala=yes
+	fi
+fi
+
+AM_CONDITIONAL(ENABLE_VALA, test "x$with_vala" = "xyes")
+
 # ********************
 # Movie player plugins
 # ********************
@@ -437,6 +461,12 @@ for plugin in ${used_plugins}; do
 				add_plugin="0"
 			fi
 		;;
+		sample-vala)
+			if test "${with_vala}" != "yes" ; then
+				plugin_error_or_ignore "you need vala installed to use the sample-vala plugin"
+				add_plugin="0"
+			fi
+		;;
 		thumbnail)
 			PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.15.0,
 				[HAVE_GLIB_2_15=yes], [HAVE_GLIB_2_15=no])
@@ -758,6 +788,7 @@ src/plugins/save-file/Makefile
 src/plugins/sidebar-test/Makefile
 src/plugins/skipto/Makefile
 src/plugins/sample-python/Makefile
+src/plugins/sample-vala/Makefile
 src/plugins/thumbnail/Makefile
 src/plugins/tracker/Makefile
 src/plugins/youtube/Makefile
diff --git a/src/Makefile.am b/src/Makefile.am
index ea7153a..e514add 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = plugins backend
+SUBDIRS = backend . plugins
 
 bin_PROGRAMS = totem totem-video-thumbnailer totem-video-indexer totem-audio-preview
 lib_LTLIBRARIES = libtotem.la
@@ -311,6 +311,7 @@ introspection_sources = $(INST_H_FILES) $(filter %.c,$(libtotem_player_la_SOURCE
 # NOTE: This should change with $(TOTEM_API_VERSION)
 Totem-1.0.gir: libtotem.la
 Totem_1_0_gir_INCLUDES = GLib-2.0 GObject-2.0 Gtk-3.0 TotemPlParser-1.0
+Totem_1_0_gir_SCANNERFLAGS = --c-include=totem.h --pkg-export=totem
 Totem_1_0_gir_CFLAGS = \
 	$(DEPENDENCY_CFLAGS)	\
 	$(PEAS_CFLAGS)		\
diff --git a/src/plugins/sample-vala/Makefile.am b/src/plugins/sample-vala/Makefile.am
new file mode 100644
index 0000000..f20c588
--- /dev/null
+++ b/src/plugins/sample-vala/Makefile.am
@@ -0,0 +1,24 @@
+include $(top_srcdir)/src/plugins/Makefile.plugins
+
+plugindir = $(PLUGINDIR)/sample-vala
+plugin_LTLIBRARIES = libsample-vala.la
+
+plugin_in_files = sample-vala.plugin.in
+
+# here we are explicitly specifying gtk+-3.0 to use the vapi because vala still
+# cannot parse the gir
+VALAFLAGS = \
+	--girdir=$(top_srcdir)/src	\
+	--pkg Totem-1.0 --pkg Peas-1.0 --pkg gtk+-3.0
+
+libsample_vala_la_SOURCES = totem-sample-vala-plugin.vala
+libsample_vala_la_LDFLAGS = $(plugin_ldflags)
+libsample_vala_la_CFLAGS = $(plugin_cflags)
+
+# Override to _not_ install the test plugins
+install-pluginLTLIBRARIES:
+install-pluginDATA:
+uninstall-pluginLTLIBRARIES:
+uninstall-pluginDATA:
+
+-include $(top_srcdir)/git.mk
diff --git a/src/plugins/sample-vala/sample-vala.plugin.in b/src/plugins/sample-vala/sample-vala.plugin.in
new file mode 100644
index 0000000..2edfdf7
--- /dev/null
+++ b/src/plugins/sample-vala/sample-vala.plugin.in
@@ -0,0 +1,8 @@
+[Plugin]
+Module=sample-vala
+IAge=1
+_Name=Vala Sample Plugin
+_Description=A useless sample plugin in Vala
+Authors=Philip Withnall <philip tecnocode co uk>
+Copyright=Copyright © 2007 James Livingston, Philip Withnall
+Website=http://www.gnome.org/projects/totem/
diff --git a/src/plugins/sample-vala/totem-sample-vala-plugin.vala b/src/plugins/sample-vala/totem-sample-vala-plugin.vala
new file mode 100644
index 0000000..d7430a7
--- /dev/null
+++ b/src/plugins/sample-vala/totem-sample-vala-plugin.vala
@@ -0,0 +1,23 @@
+using GLib;
+using Totem;
+
+class SampleValaPlugin: GLib.Object, Peas.Activatable {
+	public Totem.Object object {get; set;}
+
+	public void activate () {
+		print ("Hello world\n");
+	}
+
+	public void deactivate () {
+		print ("Goodbye world\n");
+	}
+
+	/* Gir doesn't allow marking functions as non-abstract */
+	public void update_state () {}
+}
+
+[ModuleInit]
+public void peas_register_types (GLib.TypeModule module) {
+	var objmodule = module as Peas.ObjectModule;
+	objmodule.register_extension_type (typeof(Peas.Activatable), typeof(SampleValaPlugin));
+}



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