summaryrefslogtreecommitdiff
path: root/src/plugins/Plugins.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-06-28 21:35:52 +0200
committerJörg Frings-Fürst <debian@jff.email>2023-06-28 21:35:52 +0200
commitb86540b743f1a87a163ffb811c8fe22a01fefa38 (patch)
treeb47cb3bb83c2377234226fb3987ab3320a987dd9 /src/plugins/Plugins.vala
parentac6e0b731b9f0b2efd392e3309a5c07e2a66adad (diff)
parente905d8e16eec152d19797937f13ba3cf4b8f8aca (diff)
Merge branch 'release/debian/0.32.1-1'debian/0.32.1-1
Diffstat (limited to 'src/plugins/Plugins.vala')
-rw-r--r--src/plugins/Plugins.vala45
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 {