From add097b89e4de1bfda39c3c3169d49c870b6e22e Mon Sep 17 00:00:00 2001 From: Philipp Zabel Date: Thu, 8 Jul 2010 19:31:31 +0200 Subject: [PATCH] Add gobject-2.0 fix to make TypeModule an abstract class https://bugzilla.gnome.org/show_bug.cgi?id=621317 --- Makefile.am | 3 ++- src/plugin-registrar.vala | 11 +++++++---- vapi/gobject-2.0-fix.vapi | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 vapi/gobject-2.0-fix.vapi diff --git a/Makefile.am b/Makefile.am index 0f7b627..ab4ca35 100644 --- a/Makefile.am +++ b/Makefile.am @@ -82,7 +82,8 @@ src/main.c: ${cinaest_VALASOURCES} ${VALAC} -C ${cinaest_VALASOURCES} ${cinaest_VALAFLAGS} cinaest_VALAFLAGS = --disable-dbus-transformation --vapidir ./vapi --pkg config --pkg cinaest \ - --pkg dbus-glib-1 --pkg gconf-2.0 --pkg hildon-1 --pkg libosso --pkg gmodule-2.0 + --pkg dbus-glib-1 --pkg gconf-2.0 --pkg hildon-1 --pkg libosso --pkg gmodule-2.0 \ + --pkg gobject-2.0-fix cinaest_CFLAGS = ${CINAEST_CFLAGS} ${DBUS_CFLAGS} ${GCONF_CFLAGS} ${HILDON_CFLAGS} \ ${MAEMO_LAUNCHER_CFLAGS} ${OSSO_CFLAGS} ${GMODULE_CFLAGS} \ -DGETTEXT_PACKAGE=\"@GETTEXT_PACKAGE@\" diff --git a/src/plugin-registrar.vala b/src/plugin-registrar.vala index 69eccb7..6dd314d 100644 --- a/src/plugin-registrar.vala +++ b/src/plugin-registrar.vala @@ -16,13 +16,13 @@ * along with Cinaest. If not, see . */ -public class PluginRegistrar : Object { +public class PluginRegistrar : GLibFix.TypeModule { public string path { get; construct; } private Type type; private Module module; - private delegate Type RegisterPluginFunction (); + private delegate Type RegisterPluginFunction (GLibFix.TypeModule module); construct { assert (Module.supported ()); @@ -32,7 +32,7 @@ public class PluginRegistrar : Object { Object (path: _path); } - public bool load () { + public override bool load () { stdout.printf ("Loading plugin with path: '%s'\n", path); module = Module.open (path, ModuleFlags.BIND_LAZY); @@ -46,7 +46,7 @@ public class PluginRegistrar : Object { module.symbol ("register_plugin", out function); RegisterPluginFunction register_plugin = (RegisterPluginFunction) function; - type = register_plugin (); + type = register_plugin (this); stdout.printf ("Plugin type: %s\n\n", type.name ()); // So it doesn't vanish as soon as the registar goes @@ -55,6 +55,9 @@ public class PluginRegistrar : Object { return true; } + public override void unload () { + } + public T new_object () { return Object.new (type); } diff --git a/vapi/gobject-2.0-fix.vapi b/vapi/gobject-2.0-fix.vapi new file mode 100644 index 0000000..f45e822 --- /dev/null +++ b/vapi/gobject-2.0-fix.vapi @@ -0,0 +1,15 @@ +using GLib; + +[CCode (cprefix = "G", lower_case_cprefix = "g_", cheader_filename = "glib.h", gir_namespace = "GObject", gir_version = "2.0")] +namespace GLibFix { + [CCode (lower_case_csuffix = "type_module", unref_function = "")] + public abstract class TypeModule : Object, TypePlugin { + public bool use (); + public void unuse (); + public void set_name (string name); + [NoWrapper] + public abstract bool load (); + [NoWrapper] + public abstract void unload (); + } +} -- 1.7.9.5