diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2023-06-14 20:36:17 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2023-06-14 20:36:17 +0200 |
commit | 31804433d72460cbe0a39f9f8ea5e76058d84cda (patch) | |
tree | 2084a84c39f159c6aea254775dc0880d52579d45 /src/plugins/Plugins.vala | |
parent | a9898fb3f39c44a85876930ef6b2558052569ae6 (diff) | |
parent | d443a3c2509889533ca812c163056bace396b586 (diff) |
Update upstream source from tag 'upstream/0.32.1'
Update to upstream version '0.32.1'
with Debian dir c460ad6e13d3c39eaa2d5399059385e64e6fba4c
Diffstat (limited to 'src/plugins/Plugins.vala')
-rw-r--r-- | src/plugins/Plugins.vala | 45 |
1 files changed, 18 insertions, 27 deletions
diff --git a/src/plugins/Plugins.vala b/src/plugins/Plugins.vala index 6aff461..cfab7e8 100644 --- a/src/plugins/Plugins.vala +++ b/src/plugins/Plugins.vala @@ -6,10 +6,6 @@ namespace Plugins { -// GModule doesn't have a truly generic way to determine if a file is a shared library by extension, -// so these are hard-coded -private const string[] SHARED_LIB_EXTS = { "so", "la" }; - // Although not expecting this system to last very long, these ranges declare what versions of this // interface are supported by the current implementation. private const int MIN_SPIT_INTERFACE = 0; @@ -39,8 +35,12 @@ private class ModuleRep { private ModuleRep(File file) { this.file = file; - + +#if VALA_0_46 + module = Module.open(file.get_path(), ModuleFlags.LAZY); +#else module = Module.open(file.get_path(), ModuleFlags.BIND_LAZY); +#endif } ~ModuleRep() { @@ -221,7 +221,7 @@ public string? get_pluggable_module_id(Spit.Pluggable needle) { return (module_rep != null) ? module_rep.spit_module.get_id() : null; } -public Gee.Collection<ExtensionPoint> get_extension_points(owned CompareDataFunc? compare_func = null) { +public Gee.Collection<ExtensionPoint> get_extension_points(owned CompareDataFunc<ExtensionPoint>? compare_func = null) { Gee.Collection<ExtensionPoint> sorted = new Gee.TreeSet<ExtensionPoint>((owned) compare_func); sorted.add_all(extension_points.values); @@ -229,7 +229,7 @@ public Gee.Collection<ExtensionPoint> get_extension_points(owned CompareDataFunc } public Gee.Collection<Spit.Pluggable> get_pluggables_for_type(Type type, - owned CompareDataFunc? compare_func = null, bool include_disabled = false) { + owned CompareDataFunc<Spit.Pluggable>? compare_func = null, bool include_disabled = false) { // if this triggers it means the extension point didn't register itself at init() time assert(extension_points.has_key(type)); @@ -252,12 +252,14 @@ public string? get_pluggable_name(string id) { ? pluggable_rep.pluggable.get_pluggable_name() : null; } -public bool get_pluggable_info(string id, ref Spit.PluggableInfo info) { +public bool get_pluggable_info(string id, out Spit.PluggableInfo info) { PluggableRep? pluggable_rep = pluggable_table.get(id); - if (pluggable_rep == null || !pluggable_rep.activated) + if (pluggable_rep == null || !pluggable_rep.activated) { + info = null; return false; + } - pluggable_rep.pluggable.get_info(ref info); + info = pluggable_rep.pluggable.get_info(); return true; } @@ -290,30 +292,19 @@ public File get_pluggable_module_file(Spit.Pluggable pluggable) { return (module_rep != null) ? module_rep.file : null; } -public int compare_pluggable_names(void *a, void *b) { - Spit.Pluggable *apluggable = (Spit.Pluggable *) a; - Spit.Pluggable *bpluggable = (Spit.Pluggable *) b; - - return apluggable->get_pluggable_name().collate(bpluggable->get_pluggable_name()); +public int compare_pluggable_names(Spit.Pluggable a, Spit.Pluggable b) { + return a.get_pluggable_name().collate(b.get_pluggable_name()); } -public int compare_extension_point_names(void *a, void *b) { - ExtensionPoint *apoint = (ExtensionPoint *) a; - ExtensionPoint *bpoint = (ExtensionPoint *) b; - - return apoint->name.collate(bpoint->name); +public int compare_extension_point_names(ExtensionPoint a, ExtensionPoint b) { + return a.name.collate(b.name); } private bool is_shared_library(File file) { string name, ext; disassemble_filename(file.get_basename(), out name, out ext); - - foreach (string shared_ext in SHARED_LIB_EXTS) { - if (ext == shared_ext) - return true; - } - - return false; + + return ext == Module.SUFFIX; } private void search_for_plugins(File dir) throws Error { |