[valadoc] libvaladoc: fix plugin system to work with latest valac



commit 6c594bd38387d1f41003a31f13963ab75f73258a
Author: Evan Nemerson <evan coeus-group com>
Date:   Thu May 6 13:30:38 2010 +0200

    libvaladoc: fix plugin system to work with latest valac

 src/doclets/devhelp/doclet.vala     |    2 +-
 src/doclets/gtkdoc/doclet.vala      |    2 +-
 src/doclets/htm/doclet.vala         |    2 +-
 src/doclets/valadoc.org/doclet.vala |    2 +-
 src/doclets/xml/doclet.vala         |    2 +-
 src/libvaladoc/doclet.vala          |    2 +-
 src/libvaladoc/moduleloader.vala    |   17 ++++++++---------
 src/valadoc/valadoc.vala            |    2 +-
 8 files changed, 15 insertions(+), 16 deletions(-)
---
diff --git a/src/doclets/devhelp/doclet.vala b/src/doclets/devhelp/doclet.vala
index 07280c3..e06a946 100755
--- a/src/doclets/devhelp/doclet.vala
+++ b/src/doclets/devhelp/doclet.vala
@@ -231,7 +231,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
 }
 
 [ModuleInit]
-public Type register_plugin () {
+public Type register_plugin (GLib.TypeModule module) {
 	return typeof (Valadoc.Devhelp.Doclet);
 }
 
diff --git a/src/doclets/gtkdoc/doclet.vala b/src/doclets/gtkdoc/doclet.vala
index d2e6e2a..a373d98 100644
--- a/src/doclets/gtkdoc/doclet.vala
+++ b/src/doclets/gtkdoc/doclet.vala
@@ -374,7 +374,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
 }
 
 [ModuleInit]
-public Type register_plugin ( ) {
+public Type register_plugin (GLib.TypeModule module) {
 	return typeof ( Gtkdoc.Director );
 }
 
diff --git a/src/doclets/htm/doclet.vala b/src/doclets/htm/doclet.vala
index a9e5176..18e56d3 100755
--- a/src/doclets/htm/doclet.vala
+++ b/src/doclets/htm/doclet.vala
@@ -177,7 +177,7 @@ public class Valadoc.HtmlDoclet : Valadoc.Html.BasicDoclet {
 }
 
 [ModuleInit]
-public Type register_plugin ( ) {
+public Type register_plugin (GLib.TypeModule module) {
 	return typeof ( Valadoc.HtmlDoclet );
 }
 
diff --git a/src/doclets/valadoc.org/doclet.vala b/src/doclets/valadoc.org/doclet.vala
index d6c893c..af2dbff 100755
--- a/src/doclets/valadoc.org/doclet.vala
+++ b/src/doclets/valadoc.org/doclet.vala
@@ -223,7 +223,7 @@ public class Valadoc.ValadocOrg.Doclet : Valadoc.Html.BasicDoclet {
 }
 
 [ModuleInit]
-public Type register_plugin () {
+public Type register_plugin (GLib.TypeModule module) {
 	return typeof (Valadoc.ValadocOrg.Doclet);
 }
 
diff --git a/src/doclets/xml/doclet.vala b/src/doclets/xml/doclet.vala
index 731d04a..e053001 100755
--- a/src/doclets/xml/doclet.vala
+++ b/src/doclets/xml/doclet.vala
@@ -137,6 +137,6 @@ public class Valadoc.Xml.Doclet : Api.Visitor, Valadoc.Doclet {
 }
 
 [ModuleInit]
-public Type register_plugin () {
+public Type register_plugin (GLib.TypeModule module) {
 	return typeof (Valadoc.Xml.Doclet);
 }
diff --git a/src/libvaladoc/doclet.vala b/src/libvaladoc/doclet.vala
index dc72cde..847e5e7 100755
--- a/src/libvaladoc/doclet.vala
+++ b/src/libvaladoc/doclet.vala
@@ -23,7 +23,7 @@
 using Gee;
 
 [CCode (has_target = false)]
-public delegate Type Valadoc.DocletRegisterFunction ( );
+public delegate Type Valadoc.DocletRegisterFunction (GLib.TypeModule module);
 
 public interface Valadoc.Doclet : GLib.Object {
 	public abstract void process (Settings settings, Api.Tree tree);
diff --git a/src/libvaladoc/moduleloader.vala b/src/libvaladoc/moduleloader.vala
index 616a189..2051948 100755
--- a/src/libvaladoc/moduleloader.vala
+++ b/src/libvaladoc/moduleloader.vala
@@ -27,7 +27,7 @@ using Gee;
 public delegate  void Valadoc.TagletRegisterFunction (ModuleLoader loader);
 
 
-public class Valadoc.ModuleLoader : Object {
+public class Valadoc.ModuleLoader : TypeModule {
 	public Doclet doclet;
 
 	public HashMap<string, GLib.Type> taglets = new HashMap<string, Type> (GLib.str_hash, GLib.str_equal);
@@ -35,22 +35,21 @@ public class Valadoc.ModuleLoader : Object {
 	private Module docletmodule;
 	private Type doclettype;
 
-	public bool load (string path) {
-		bool tmp = this.load_doclet (path);
-		if (tmp == false) {
-			return false;
-		}
+	public override bool load () {
 		return true;
 	}
 
+	public override void unload() {
+	}
+
 	public Content.Taglet? create_taglet (string keyword) {
 		return (taglets.has_key (keyword))? (Content.Taglet) GLib.Object.new (taglets.get (keyword)) : null;
 	}
 
-	private bool load_doclet (string path) {
+	public bool load_doclet (string path) {
 		void* function;
 
-		docletmodule = Module.open (Module.build_path (path, "libdoclet"), ModuleFlags.BIND_LAZY);
+		docletmodule = Module.open (Module.build_path (path, "libdoclet"), ModuleFlags.BIND_LAZY | ModuleFlags.BIND_LOCAL);
 		if (docletmodule == null) {
 			return false;
 		}
@@ -61,7 +60,7 @@ public class Valadoc.ModuleLoader : Object {
 		}
 
 		Valadoc.DocletRegisterFunction doclet_register_function = (Valadoc.DocletRegisterFunction) function;
-		doclettype = doclet_register_function ();
+		doclettype = doclet_register_function (this);
 		this.doclet = (Doclet)GLib.Object.new (doclettype);
 		return true;
 	}
diff --git a/src/valadoc/valadoc.vala b/src/valadoc/valadoc.vala
index fa42134..a0be66b 100755
--- a/src/valadoc/valadoc.vala
+++ b/src/valadoc/valadoc.vala
@@ -182,7 +182,7 @@ public class ValaDoc : Object {
 
 		ModuleLoader modules = new ModuleLoader ();
 		Taglets.init (modules);
-		bool tmp = modules.load (fulldirpath);
+		bool tmp = modules.load_doclet (fulldirpath);
 		if (tmp == false) {
 			reporter.simple_error ("failed to load plugin");
 			return quit (reporter);



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