From 0dad64a81d1116560cab1c280da6716b6122cd99 Mon Sep 17 00:00:00 2001 From: Niels De Graef Date: Fri, 12 Dec 2025 00:34:02 +0100 Subject: [PATCH] Port plugins from libpeas-1 to libpeas-2 The newer version of libpeas was released a couple of years ago already, and at this point should probably be consdered the only maintained version. The changes are pretty minimal, and most should be pretty obvious from the libpeas migration guide. The only annoying thing is that we can't use `Peas.Engine.create_extension()` directly, since it's not exposed to language bindings (even to Vala, which supports varargs, but alas). Link: https://gnome.pages.gitlab.gnome.org/libpeas/libpeas-2/migrating-1to2.html Fixes: https://gitlab.gnome.org/GNOME/geary/-/issues/1690 --- .gitlab-ci.yml | 4 ++-- meson.build | 2 +- org.gnome.Geary.json | 12 ++++++++++-- .../application/application-plugin-manager.vala | 15 +++++++++++---- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8c5abbc3..ad95fd79 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -74,7 +74,7 @@ build.container.fedora@x86_64: libgee-devel libhandy1-devel libicu-devel - libpeas1-devel + libpeas-devel libsecret-devel libstemmer-devel libunwind-devel @@ -94,7 +94,7 @@ build.container.fedora@x86_64: # release branch name to ensure that a new image will # be created, tailored for the stable branch. BRANCH_NAME: 'main' - CONTAINER_TAG: '2025-11-23.0' + CONTAINER_TAG: '2025-12-11.0' FEDORA_VERSION: latest # Derive FDO variables from this automatically. # DO NOT edit, instead change the variables above diff --git a/meson.build b/meson.build index 215bd407..5a434d6f 100644 --- a/meson.build +++ b/meson.build @@ -87,7 +87,7 @@ javascriptcoregtk = dependency('javascriptcoregtk-4.1', version: '>=' + target_w json_glib = dependency('json-glib-1.0', version: '>= 1.0') libhandy = dependency('libhandy-1', version: '>= 1.6', required: false) libmath = cc.find_library('m') -libpeas = dependency('libpeas-1.0', version: '>= 1.24.0') +libpeas = dependency('libpeas-2') libsecret = dependency('libsecret-1', version: '>= 0.11') libsoup = dependency('libsoup-3.0') libstemmer_dep = cc.find_library('stemmer') diff --git a/org.gnome.Geary.json b/org.gnome.Geary.json index 6e77491d..f4ddf12a 100644 --- a/org.gnome.Geary.json +++ b/org.gnome.Geary.json @@ -218,11 +218,19 @@ { "name": "libpeas", "buildsystem": "meson", + "config-opts": [ + "-Dgtk_doc=false", + "-Dintrospection=true", + "-Dvapi=true", + "-Dlua51=false", + "-Dgjs=false", + "-Dpython3=false" + ], "sources": [ { "type": "git", - "url": "https://gitlab.gnome.org/GNOME/libpeas.git", - "commit": "7f245fa5158204621c3469756a951b68a651c4fe" + "url": "https://gitlab.gnome.org/GNOME/libpeas", + "branch": "main" } ] }, diff --git a/src/client/application/application-plugin-manager.vala b/src/client/application/application-plugin-manager.vala index 794e1691..178c0c54 100644 --- a/src/client/application/application-plugin-manager.vala +++ b/src/client/application/application-plugin-manager.vala @@ -89,10 +89,13 @@ public class Application.PluginManager : GLib.Object { Client application, PluginGlobals globals) throws GLib.Error { var app_impl = new ApplicationImpl(application, this, globals); - var instance = engine.create_extension( + var app_impl_val = GLib.Value(typeof(ApplicationImpl)); + app_impl_val.set_object(app_impl); + var instance = engine.create_extension_with_properties( info, typeof(Plugin.PluginBase), - "plugin_application", app_impl + { "plugin_application" }, + { app_impl_val } ) as Plugin.PluginBase; if (instance == null) { throw new Plugin.Error.NOT_SUPPORTED( @@ -594,7 +597,9 @@ public class Application.PluginManager : GLib.Object { controller.composer_deregistered.connect(this.on_composer_deregistered); string[] optional_names = this.config.get_optional_plugins(); - foreach (Peas.PluginInfo info in this.plugin_engine.get_plugin_list()) { + for (uint i = 0; i < this.plugin_engine.get_n_items(); i++) { + var info = (Peas.PluginInfo) this.plugin_engine.get_item(i); + string name = info.get_module_name(); try { if (info.is_available()) { @@ -638,7 +643,9 @@ public class Application.PluginManager : GLib.Object { public Gee.Collection get_optional_plugins() { var plugins = new Gee.LinkedList(); - foreach (Peas.PluginInfo plugin in this.plugin_engine.get_plugin_list()) { + for (uint i = 0; i < this.plugin_engine.get_n_items(); i++) { + var plugin = (Peas.PluginInfo) this.plugin_engine.get_item(i); + try { plugin.is_available(); if (!is_autoload(plugin)) {