From a9ea0e9f87e71c60bc570066525d3e3634fbdcc0 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sun, 12 Mar 2017 02:28:23 +0100 Subject: Split OMEMO plug-in into files, various fixes --- libdino/CMakeLists.txt | 1 - libdino/src/plugin/loader.vala | 15 ++++----------- 2 files changed, 4 insertions(+), 12 deletions(-) (limited to 'libdino') diff --git a/libdino/CMakeLists.txt b/libdino/CMakeLists.txt index 10972b9a..08bf88d6 100644 --- a/libdino/CMakeLists.txt +++ b/libdino/CMakeLists.txt @@ -4,7 +4,6 @@ include(${VALA_USE_FILE}) set(LIBDINO_PACKAGES gee-0.8 - gio-2.0 glib-2.0 gtk+-3.0 gmodule-2.0 diff --git a/libdino/src/plugin/loader.vala b/libdino/src/plugin/loader.vala index 43ce0801..acb26ff4 100644 --- a/libdino/src/plugin/loader.vala +++ b/libdino/src/plugin/loader.vala @@ -1,12 +1,5 @@ namespace Dino.Plugins { -public errordomain Error { - NOT_SUPPORTED, - UNEXPECTED_TYPE, - NO_REGISTRATION_FUNCTION, - FAILED -} - private class Info : Object { public Module module; public Type gtype; @@ -26,24 +19,24 @@ public class Loader : Object { public RootInterface load(string name, Dino.Application app) throws Error { if (Module.supported () == false) { - throw new Error.NOT_SUPPORTED ("Plugins are not supported"); + throw new Error (-1, 0, "Plugins are not supported"); } Module module = Module.open ("plugins/" + name, ModuleFlags.BIND_LAZY); if (module == null) { - throw new Error.FAILED (Module.error ()); + throw new Error (-1, 1, Module.error ()); } void* function; module.symbol ("register_plugin", out function); if (function == null) { - throw new Error.NO_REGISTRATION_FUNCTION ("register_plugin () not found"); + throw new Error (-1, 2, "register_plugin () not found"); } RegisterPluginFunction register_plugin = (RegisterPluginFunction) function; Type type = register_plugin (module); if (type.is_a (typeof (RootInterface)) == false) { - throw new Error.UNEXPECTED_TYPE ("Unexpected type"); + throw new Error (-1, 3, "Unexpected type"); } Info info = new Plugins.Info (type, (owned) module); -- cgit v1.2.3-70-g09d2