diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 62c8a53c42..782a5dcad2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: - name: Install Dependencies run: | apt update - apt install -y exuberant-ctags libeditorconfig-dev libgail-3-dev libgee-0.8-dev libgit2-glib-1.0-dev libgranite-dev libgtk-3-dev libgtksourceview-4-dev libgtkspell3-3-dev libhandy-1-dev libpeas-dev libsoup2.4-dev libvala-dev libvte-2.91-dev meson valac polkitd libpolkit-gobject-1-dev + apt install -y exuberant-ctags libeditorconfig-dev libgail-3-dev libgee-0.8-dev libgit2-glib-1.0-dev libgranite-dev libgtk-3-dev libgtksourceview-4-dev libgtkspell3-3-dev libhandy-1-dev libpeas-2-dev libsoup-3.0-dev libvala-dev libvte-2.91-dev meson valac polkitd libpolkit-gobject-1-dev - name: Build env: DESTDIR: out diff --git a/README.md b/README.md index 9f440e8b3e..9682f0b07b 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ You'll need the following dependencies: * libgtkspell3-3-dev * libgranite-dev >= 6.0.0 * libhandy-1-dev >= 0.90.0 -* libpeas-dev +* libpeas-2-dev * libsoup2.4-dev * libvala-0.48-dev (or higher) * libvte-2.91-dev diff --git a/io.elementary.code.yml b/io.elementary.code.yml index c0764fbf43..fc654e9cfa 100644 --- a/io.elementary.code.yml +++ b/io.elementary.code.yml @@ -33,16 +33,20 @@ modules: url: https://gitlab.gnome.org/GNOME/gtksourceview.git tag: '4.8.4' - - name: peas + - name: libpeas buildsystem: meson config-opts: - - '-Dgtk_doc=false' - - '-Ddemos=false' - - '-Dvapi=true' + - -Dlua51=false + - -Dgjs=false sources: - - type: git - url: https://gitlab.gnome.org/GNOME/libpeas.git - tag: libpeas-1.34.0 + - type: archive + url: https://download.gnome.org/sources/libpeas/2.0/libpeas-2.0.5.tar.xz + sha256: 376f2f73d731b54e13ddbab1d91b6382cf6a980524def44df62add15489de6dd + x-checker-data: + type: gnome + versions: + <: '2.0.6' + name: libpeas - name: git2-glib buildsystem: meson diff --git a/meson.build b/meson.build index b600a80667..70b4375222 100644 --- a/meson.build +++ b/meson.build @@ -26,15 +26,14 @@ pluginsdir = get_option('prefix') / get_option('libdir') / meson.project_name() gnome = import('gnome') i18n = import('i18n') -glib_dep = dependency('glib-2.0', version: '>=2.30.0') +glib_dep = dependency('glib-2.0', version: '>=2.74.0') gio_unix_dep = dependency('gio-unix-2.0', version: '>=2.20') gee_dep = dependency('gee-0.8', version: '>=0.8.5') gtk_dep = dependency('gtk+-3.0', version: '>=3.6.0') granite_dep = dependency('granite', version: '>=6.0.0') handy_dep = dependency('libhandy-1', version: '>=0.90.0') gtksourceview_dep = dependency('gtksourceview-4') -peas_dep = dependency('libpeas-1.0') -peasgtk_dep = dependency('libpeas-gtk-1.0') +peas_dep = dependency('libpeas-2') git_dep = dependency('libgit2-glib-1.0') fontconfig_dep = dependency('fontconfig') pangofc_dep = dependency('pangoft2') @@ -59,7 +58,6 @@ dependencies = [ handy_dep, gtksourceview_dep, peas_dep, - peasgtk_dep, git_dep, fontconfig_dep, pangofc_dep, diff --git a/plugins/brackets-completion/brackets-completion.vala b/plugins/brackets-completion/brackets-completion.vala index bf3f4cf15c..a252df5196 100644 --- a/plugins/brackets-completion/brackets-completion.vala +++ b/plugins/brackets-completion/brackets-completion.vala @@ -18,7 +18,7 @@ END LICENSE ***/ -public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Peas.Activatable { +public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Scratch.Services.ActivatablePlugin { Gee.HashMap brackets; Gee.HashMap keys; const string[] VALID_NEXT_CHARS = { @@ -278,6 +278,6 @@ public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Peas.Activ [ModuleInit] public void peas_register_types (GLib.TypeModule module) { var objmodule = module as Peas.ObjectModule; - objmodule.register_extension_type (typeof (Peas.Activatable), + objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin), typeof (Scratch.Plugins.BracketsCompletion)); } diff --git a/plugins/detect-indent/detect-indent.vala b/plugins/detect-indent/detect-indent.vala index 09fe9c1d24..1e267685e5 100644 --- a/plugins/detect-indent/detect-indent.vala +++ b/plugins/detect-indent/detect-indent.vala @@ -1,4 +1,4 @@ -public class Scratch.Plugins.DetectIndent: Peas.ExtensionBase, Peas.Activatable { +public class Scratch.Plugins.DetectIndent: Peas.ExtensionBase, Scratch.Services.ActivatablePlugin { const int MAX_LINES = 500; Scratch.Services.Interface plugins; @@ -79,7 +79,7 @@ public class Scratch.Plugins.DetectIndent: Peas.ExtensionBase, Peas.Activatable public void peas_register_types (GLib.TypeModule module) { var objmodule = module as Peas.ObjectModule; objmodule.register_extension_type ( - typeof (Peas.Activatable), + typeof (Scratch.Services.ActivatablePlugin), typeof (Scratch.Plugins.DetectIndent) ); } diff --git a/plugins/editorconfig/editorconfig.vala b/plugins/editorconfig/editorconfig.vala index 3f7a7948e7..8286cf0b6a 100644 --- a/plugins/editorconfig/editorconfig.vala +++ b/plugins/editorconfig/editorconfig.vala @@ -17,7 +17,7 @@ * Boston, MA 02110-1301 USA */ -public class Scratch.Plugins.EditorConfigPlugin: Peas.ExtensionBase, Peas.Activatable { +public class Scratch.Plugins.EditorConfigPlugin: Peas.ExtensionBase, Scratch.Services.ActivatablePlugin { Scratch.Services.Interface plugins; public Object object { owned get; construct; } private Code.FormatBar format_bar; @@ -96,5 +96,5 @@ public class Scratch.Plugins.EditorConfigPlugin: Peas.ExtensionBase, Peas.Activa [ModuleInit] public void peas_register_types (GLib.TypeModule module) { var objmodule = module as Peas.ObjectModule; - objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.EditorConfigPlugin)); + objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin), typeof (Scratch.Plugins.EditorConfigPlugin)); } diff --git a/plugins/fuzzy-search/fuzzy-search.vala b/plugins/fuzzy-search/fuzzy-search.vala index 8226a164bd..c28a54450e 100644 --- a/plugins/fuzzy-search/fuzzy-search.vala +++ b/plugins/fuzzy-search/fuzzy-search.vala @@ -6,7 +6,7 @@ */ -public class Scratch.Plugins.FuzzySearch: Peas.ExtensionBase, Peas.Activatable { +public class Scratch.Plugins.FuzzySearch: Peas.ExtensionBase, Scratch.Services.ActivatablePlugin { public Object object { owned get; construct; } private const uint ACCEL_KEY = Gdk.Key.F; private const Gdk.ModifierType ACCEL_MODTYPE = Gdk.ModifierType.MOD1_MASK; @@ -158,7 +158,7 @@ public class Scratch.Plugins.FuzzySearch: Peas.ExtensionBase, Peas.Activatable { public void peas_register_types (GLib.TypeModule module) { var objmodule = module as Peas.ObjectModule; objmodule.register_extension_type ( - typeof (Peas.Activatable), + typeof (Scratch.Services.ActivatablePlugin), typeof (Scratch.Plugins.FuzzySearch) ); } diff --git a/plugins/highlight-word-selection/highlight-word-selection.vala b/plugins/highlight-word-selection/highlight-word-selection.vala index 9306321f2e..91303df71d 100644 --- a/plugins/highlight-word-selection/highlight-word-selection.vala +++ b/plugins/highlight-word-selection/highlight-word-selection.vala @@ -18,7 +18,7 @@ END LICENSE ***/ -public class Scratch.Plugins.HighlightSelectedWords : Peas.ExtensionBase, Peas.Activatable { +public class Scratch.Plugins.HighlightSelectedWords : Peas.ExtensionBase, Scratch.Services.ActivatablePlugin { Scratch.Widgets.SourceView current_source; Scratch.MainWindow? main_window = null; Gtk.SourceSearchContext? current_search_context = null; @@ -145,6 +145,6 @@ public class Scratch.Plugins.HighlightSelectedWords : Peas.ExtensionBase, Peas.A [ModuleInit] public void peas_register_types (TypeModule module) { var objmodule = module as Peas.ObjectModule; - objmodule.register_extension_type (typeof (Peas.Activatable), + objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin), typeof (Scratch.Plugins.HighlightSelectedWords)); } diff --git a/plugins/markdown-actions/markdown-actions.vala b/plugins/markdown-actions/markdown-actions.vala index 024e97c3b6..d53bf4fcd8 100644 --- a/plugins/markdown-actions/markdown-actions.vala +++ b/plugins/markdown-actions/markdown-actions.vala @@ -18,7 +18,7 @@ END LICENSE ***/ -public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Peas.Activatable { +public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Scratch.Services.ActivatablePlugin { Scratch.Widgets.SourceView current_source; Scratch.Services.Interface plugins; @@ -243,6 +243,6 @@ public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Peas.Activatable [ModuleInit] public void peas_register_types (TypeModule module) { var objmodule = module as Peas.ObjectModule; - objmodule.register_extension_type (typeof (Peas.Activatable), + objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin), typeof (Code.Plugins.MarkdownActions)); } diff --git a/plugins/pastebin/meson.build b/plugins/pastebin/meson.build index f18e644d41..b426acff0e 100644 --- a/plugins/pastebin/meson.build +++ b/plugins/pastebin/meson.build @@ -5,7 +5,7 @@ module_files = [ 'pastebin.vala' ] -soup_dep = dependency('libsoup-2.4') +soup_dep = dependency('libsoup-3.0') module_deps = [ codecore_dep, diff --git a/plugins/pastebin/pastebin.vala b/plugins/pastebin/pastebin.vala index 3a4471dc21..2d32634904 100644 --- a/plugins/pastebin/pastebin.vala +++ b/plugins/pastebin/pastebin.vala @@ -34,6 +34,7 @@ namespace Scratch.Services { string paste_private, string paste_expire_date, string paste_format) { + link = null; if (paste_code.length == 0) { link = "No text to paste"; return false; } string api_url = "https://pastebin.com/api/api_post.php"; @@ -50,15 +51,21 @@ namespace Scratch.Services { "api_paste_expire_date", paste_expire_date, "api_paste_format", paste_format); - message.set_request ("application/x-www-form-urlencoded", Soup.MemoryUse.COPY, request.data); + message.set_request_body_from_bytes ("application/x-www-form-urlencoded", new Bytes (request.data)); message.set_flags (Soup.MessageFlags.NO_REDIRECT); - session.send_message (message); + Bytes output; + try { + output = session.send_and_read (message); + } catch (Error e) { + return false; + } + - var output = (string) message.response_body.data; - link = output; + var output_s = (string) output.get_data (); + link = output_s; - if (Uri.parse_scheme (output) == null || message.status_code != 200) { + if (Uri.parse_scheme (output_s) == null || message.status_code != 200) { // A URI was not returned return false; } @@ -68,7 +75,7 @@ namespace Scratch.Services { } } -public class Scratch.Plugins.Pastebin : Peas.ExtensionBase, Peas.Activatable { +public class Scratch.Plugins.Pastebin : Peas.ExtensionBase, Scratch.Services.ActivatablePlugin { GLib.MenuItem? menuitem = null; GLib.Menu? share_menu = null; public Object object { owned get; construct; } @@ -147,6 +154,6 @@ public class Scratch.Plugins.Pastebin : Peas.ExtensionBase, Peas.Activatable { [ModuleInit] public void peas_register_types (GLib.TypeModule module) { var objmodule = module as Peas.ObjectModule; - objmodule.register_extension_type (typeof (Peas.Activatable), + objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin), typeof (Scratch.Plugins.Pastebin)); } diff --git a/plugins/preserve-indent/preserve-indent.vala b/plugins/preserve-indent/preserve-indent.vala index 6f07e0c3d3..bfb8ff801b 100644 --- a/plugins/preserve-indent/preserve-indent.vala +++ b/plugins/preserve-indent/preserve-indent.vala @@ -18,7 +18,7 @@ END LICENSE ***/ -public class Scratch.Plugins.PreserveIndent : Peas.ExtensionBase, Peas.Activatable { +public class Scratch.Plugins.PreserveIndent : Peas.ExtensionBase, Scratch.Services.ActivatablePlugin { private Scratch.Services.Interface plugins; private Gee.TreeSet documents; @@ -244,6 +244,6 @@ public class Scratch.Plugins.PreserveIndent : Peas.ExtensionBase, Peas.Activatab [ModuleInit] public void peas_register_types (GLib.TypeModule module) { var objmodule = module as Peas.ObjectModule; - objmodule.register_extension_type (typeof (Peas.Activatable), + objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin), typeof (Scratch.Plugins.PreserveIndent)); } diff --git a/plugins/spell/spell.vala b/plugins/spell/spell.vala index 6e90e60e2f..f27bae823f 100644 --- a/plugins/spell/spell.vala +++ b/plugins/spell/spell.vala @@ -13,7 +13,7 @@ * with this program. If not, see */ -public class Scratch.Plugins.Spell: Peas.ExtensionBase, Peas.Activatable { +public class Scratch.Plugins.Spell: Peas.ExtensionBase, Scratch.Services.ActivatablePlugin { Scratch.Services.Interface plugins; @@ -160,7 +160,7 @@ public class Scratch.Plugins.Spell: Peas.ExtensionBase, Peas.Activatable { public void peas_register_types (GLib.TypeModule module) { var objmodule = module as Peas.ObjectModule; objmodule.register_extension_type ( - typeof (Peas.Activatable), + typeof (Scratch.Services.ActivatablePlugin), typeof (Scratch.Plugins.Spell) ); } diff --git a/plugins/vim-emulation/vim-emulation.vala b/plugins/vim-emulation/vim-emulation.vala index 32ec3c397a..426737da21 100644 --- a/plugins/vim-emulation/vim-emulation.vala +++ b/plugins/vim-emulation/vim-emulation.vala @@ -18,7 +18,7 @@ END LICENSE ***/ -public class Scratch.Plugins.VimEmulation : Peas.ExtensionBase, Peas.Activatable { +public class Scratch.Plugins.VimEmulation : Peas.ExtensionBase, Scratch.Services.ActivatablePlugin { public enum Mode { COMMAND, INSERT, @@ -298,6 +298,6 @@ public class Scratch.Plugins.VimEmulation : Peas.ExtensionBase, Peas.Activatable [ModuleInit] public void peas_register_types (GLib.TypeModule module) { var objmodule = module as Peas.ObjectModule; - objmodule.register_extension_type (typeof (Peas.Activatable), + objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin), typeof (Scratch.Plugins.VimEmulation)); } diff --git a/plugins/word-completion/plugin.vala b/plugins/word-completion/plugin.vala index ceccafa8d1..176dd5ece1 100644 --- a/plugins/word-completion/plugin.vala +++ b/plugins/word-completion/plugin.vala @@ -18,7 +18,7 @@ * */ -public class Scratch.Plugins.Completion : Peas.ExtensionBase, Peas.Activatable { +public class Scratch.Plugins.Completion : Peas.ExtensionBase, Scratch.Services.ActivatablePlugin { public const uint INTERACTIVE_DELAY = 500; public Object object { owned get; construct; } @@ -185,6 +185,6 @@ public class Scratch.Plugins.Completion : Peas.ExtensionBase, Peas.Activatable { [ModuleInit] public void peas_register_types (GLib.TypeModule module) { var objmodule = module as Peas.ObjectModule; - objmodule.register_extension_type (typeof (Peas.Activatable), + objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin), typeof (Scratch.Plugins.Completion)); } diff --git a/src/Dialogs/PreferencesDialog.vala b/src/Dialogs/PreferencesDialog.vala index 96f2de4590..53288c3985 100644 --- a/src/Dialogs/PreferencesDialog.vala +++ b/src/Dialogs/PreferencesDialog.vala @@ -144,9 +144,9 @@ public class Scratch.Dialogs.Preferences : Granite.Dialog { main_box.add (stackswitcher); main_box.add (stack); - plugins.hook_preferences_dialog (this); + plugins.hook_preferences_dialog (this); // Unused? - if (Peas.Engine.get_default ().get_plugin_list ().length () > 0) { + if (plugins.get_n_plugins () > 0) { var pbox = plugins.get_view (); pbox.vexpand = true; @@ -160,6 +160,11 @@ public class Scratch.Dialogs.Preferences : Granite.Dialog { close_button.clicked.connect (() => { destroy (); }); + + //Ensure appearance correct after using libpeas-2 + realize.connect (() => { + stack.set_visible_child_name ("behavior"); + }); } private class SettingSwitch : Gtk.Grid { diff --git a/src/Services/PluginManager.vala b/src/Services/PluginManager.vala index 749a4768ae..b460041e44 100644 --- a/src/Services/PluginManager.vala +++ b/src/Services/PluginManager.vala @@ -2,7 +2,9 @@ /*** BEGIN LICENSE - Copyright (C) 2013 Mario Guerriero + Copyright (C) 2019–2024 elementary, Inc. + 2013 Mario Guerriero + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3, as published by the Free Software Foundation. @@ -19,10 +21,17 @@ ***/ namespace Scratch.Services { - public class Interface : GLib.Object { - - public PluginsManager manager; + // Interface implemented by all plugins + public interface ActivatablePlugin : Object { + // Migrated from Peas.Activatable + public abstract void activate (); + public abstract void deactivate (); + public virtual void update_state () {} + public abstract GLib.Object object { owned get; construct; } + } + // Object shared with plugins providing signals and methods to interface with application + public class Interface : GLib.Object { // Signals public signal void hook_window (Scratch.MainWindow window); public signal void hook_share_menu (GLib.MenuModel menu); @@ -31,11 +40,16 @@ namespace Scratch.Services { public signal void hook_preferences_dialog (Scratch.Dialogs.Preferences dialog); public signal void hook_folder_item_change (File file, File? other_file, FileMonitorEvent event_type); - public Scratch.TemplateManager template_manager { private set; get; } + public Scratch.TemplateManager template_manager { get; construct; } + public Scratch.Services.PluginsManager manager { get; construct; } - public Interface (PluginsManager manager) { - this.manager = manager; + public Interface (PluginsManager _manager) { + Object ( + manager: _manager + ); + } + construct { template_manager = new Scratch.TemplateManager (); } @@ -50,16 +64,12 @@ namespace Scratch.Services { } } - public class PluginsManager : GLib.Object { Peas.Engine engine; Peas.ExtensionSet exts; - string settings_field; - public Interface plugin_iface { private set; public get; } - - public weak MainWindow window; + public weak MainWindow window {get; construct; } // Signals public signal void hook_window (Scratch.MainWindow window); @@ -72,11 +82,13 @@ namespace Scratch.Services { public signal void extension_added (Peas.PluginInfo info); public signal void extension_removed (Peas.PluginInfo info); - public PluginsManager (MainWindow window) { - this.window = window; - - settings_field = "plugins-enabled"; + public PluginsManager (MainWindow _window) { + Object ( + window: _window + ); + } + construct { plugin_iface = new Interface (this); /* Let's init the engine */ @@ -86,19 +98,24 @@ namespace Scratch.Services { Scratch.settings.bind ("plugins-enabled", engine, "loaded-plugins", SettingsBindFlags.DEFAULT); /* Our extension set */ - exts = new Peas.ExtensionSet (engine, typeof (Peas.Activatable), "object", plugin_iface, null); + exts = new Peas.ExtensionSet.with_properties ( + engine, + typeof (ActivatablePlugin), + {"object"}, + {plugin_iface} + ); exts.extension_added.connect ((info, ext) => { - ((Peas.Activatable)ext).activate (); + ((ActivatablePlugin)ext).activate (); extension_added (info); }); exts.extension_removed.connect ((info, ext) => { - ((Peas.Activatable)ext).deactivate (); + ((ActivatablePlugin)ext).deactivate (); extension_removed (info); }); - exts.foreach (on_extension_foreach); + exts.@foreach ((Peas.ExtensionSetForeachFunc) on_extension_foreach, null); // Connect managers signals to interface's signals this.hook_window.connect ((w) => { @@ -126,15 +143,81 @@ namespace Scratch.Services { }); } - void on_extension_foreach (Peas.ExtensionSet set, Peas.PluginInfo info, Peas.Extension extension) { - ((Peas.Activatable)extension).activate (); + void on_extension_foreach (Peas.ExtensionSet exts, Peas.PluginInfo info, Object ext, void* data) { + ((ActivatablePlugin)ext).activate (); } + // Return an emulation of the discontinued libpeas-1.0 widget public Gtk.Widget get_view () { - var view = new PeasGtk.PluginManager (engine); - var bottom_box = view.get_children ().nth_data (1); - bottom_box.no_show_all = true; - return view; + var list_box = new Gtk.ListBox (); + var scrolled_window = new Gtk.ScrolledWindow (null, null) { + hscrollbar_policy = NEVER, + vscrollbar_policy = AUTOMATIC, + max_content_height = 300, + child = list_box + }; + var frame = new Gtk.Frame (null) { + child = scrolled_window + }; + + // Bind the engine ListModel and use a row factory + list_box.bind_model (engine, get_widget_for_plugin_info); + // Cannot sort a ListModel so sort the ListBox (is there a better way?) + // Gtk warns the function will be ignored but it does in fact work, at least + // on initial display. We know the model will not change while the view is used + // In Gtk4 could use SortListModel + list_box.set_sort_func ((r1, r2) => { + return strcmp ( + r1.get_child ().get_data ("name"), + r2.get_child ().get_data ("name") + ); + }); + frame.show_all (); + return frame; + } + + private Gtk.Widget get_widget_for_plugin_info (Object obj) { + var info = (Peas.PluginInfo)obj; + var content = new Gtk.Box (HORIZONTAL, 6); + var checkbox = new Gtk.CheckButton () { + valign = Gtk.Align.CENTER, + active = info.is_loaded (), + margin_start = 6 + }; + checkbox.toggled.connect (() => { + if (checkbox.active) { + engine.load_plugin (info); + } else { + engine.unload_plugin (info); + } + }); + var image = new Gtk.Image.from_icon_name (info.get_icon_name (), LARGE_TOOLBAR) { + valign = Gtk.Align.CENTER + }; + var description_box = new Gtk.Box (VERTICAL, 0); + var name_label = new Granite.HeaderLabel (info.name); + //TODO In Granite-7 we can use secondary text property but emulate for now + var description_label = new Gtk.Label (info.get_description ()) { + use_markup = true, + wrap = true, + xalign = 0, + margin_start = 6, + margin_bottom = 6 + }; + description_label.get_style_context ().add_class (Granite.STYLE_CLASS_SMALL_LABEL); + description_label.get_style_context ().add_class (Gtk.STYLE_CLASS_DIM_LABEL); + description_box.add (name_label); + description_box.add (description_label); + content.add (checkbox); + content.add (image); + content.add (description_box); + content.set_data ("name", info.get_name ()); + + return content; + } + + public uint get_n_plugins () { + return engine.get_n_items (); } } } diff --git a/vapi/libpeas-2.vapi b/vapi/libpeas-2.vapi new file mode 100644 index 0000000000..c870b6a04b --- /dev/null +++ b/vapi/libpeas-2.vapi @@ -0,0 +1,136 @@ +/* libpeas-2.vapi generated by vapigen, do not modify. */ + +[CCode (cprefix = "Peas", gir_namespace = "Peas", gir_version = "2", lower_case_cprefix = "peas_")] +namespace Peas { + [CCode (cheader_filename = "libpeas.h", type_id = "peas_engine_get_type ()")] + public sealed class Engine : GLib.Object, GLib.ListModel { + [CCode (has_construct_function = false)] + public Engine (); + public void add_search_path (string module_dir, string? data_dir); + public GLib.Object create_extension_with_properties (Peas.PluginInfo info, GLib.Type extension_type, [CCode (array_length_cname = "n_properties", array_length_pos = 2.5, array_length_type = "guint")] string[] prop_names, [CCode (array_length_cname = "n_properties", array_length_pos = 2.5, array_length_type = "guint")] GLib.Value[] prop_values); + [CCode (array_length = false, array_null_terminated = true)] + public string[] dup_loaded_plugins (); + public void enable_loader (string loader_name); + public void garbage_collect (); + public static unowned Peas.Engine get_default (); + public unowned Peas.PluginInfo get_plugin_info (string plugin_name); + public bool provides_extension (Peas.PluginInfo info, GLib.Type extension_type); + public void rescan_plugins (); + public void set_loaded_plugins ([CCode (array_length = false, array_null_terminated = true)] string[]? plugin_names); + [CCode (has_construct_function = false)] + public Engine.with_nonglobal_loaders (); + [CCode (array_length = false, array_null_terminated = true)] + [NoAccessorMethod] + public string[] loaded_plugins { owned get; set; } + [NoAccessorMethod] + public bool nonglobal_loaders { get; construct; } + [HasEmitter] + public signal void load_plugin (Peas.PluginInfo info); + [HasEmitter] + public signal void unload_plugin (Peas.PluginInfo info); + } + [CCode (cheader_filename = "libpeas.h", type_id = "peas_extension_base_get_type ()")] + public abstract class ExtensionBase : GLib.Object { + [CCode (has_construct_function = false)] + protected ExtensionBase (); + public string get_data_dir (); + public unowned Peas.PluginInfo get_plugin_info (); + public string data_dir { owned get; } + public Peas.PluginInfo plugin_info { get; construct; } + } + [CCode (cheader_filename = "libpeas.h", type_id = "peas_extension_set_get_type ()")] + public sealed class ExtensionSet : GLib.Object, GLib.ListModel { + [CCode (has_construct_function = false)] + protected ExtensionSet (); + public void @foreach (Peas.ExtensionSetForeachFunc func, void* data); + public unowned GLib.Object? get_extension (Peas.PluginInfo info); + [CCode (has_construct_function = false)] + public ExtensionSet.with_properties (Peas.Engine? engine, GLib.Type exten_type, [CCode (array_length_cname = "n_properties", array_length_pos = 2.5, array_length_type = "guint")] string[] prop_names, [CCode (array_length_cname = "n_properties", array_length_pos = 2.5, array_length_type = "guint")] GLib.Value[] prop_values); + [NoAccessorMethod] + public void* construct_properties { construct; } + [NoAccessorMethod] + public Peas.Engine engine { owned get; construct; } + [NoAccessorMethod] + public GLib.Type extension_type { get; construct; } + public signal void extension_added (Peas.PluginInfo info, GLib.Object extension); + public signal void extension_removed (Peas.PluginInfo info, GLib.Object extension); + } + [CCode (cheader_filename = "libpeas.h", type_id = "peas_object_module_get_type ()")] + public class ObjectModule : GLib.TypeModule, GLib.TypePlugin { + [CCode (has_construct_function = false)] + protected ObjectModule (); + public void register_extension_factory (GLib.Type exten_type, owned Peas.FactoryFunc factory_func); + public void register_extension_type (GLib.Type exten_type, GLib.Type impl_type); + [NoAccessorMethod] + public bool local_linkage { get; construct; } + [NoAccessorMethod] + public string module_name { owned get; construct; } + [NoAccessorMethod] + public string path { owned get; construct; } + [NoAccessorMethod] + public bool resident { get; construct; } + [NoAccessorMethod] + public string symbol { owned get; construct; } + } + [CCode (cheader_filename = "libpeas.h", type_id = "peas_plugin_info_get_type ()")] + public sealed class PluginInfo : GLib.Object { + [CCode (has_construct_function = false)] + protected PluginInfo (); + public static GLib.Quark error_quark (); + [CCode (array_length = false, array_null_terminated = true)] + public unowned string[] get_authors (); + public unowned string get_copyright (); + public unowned string get_data_dir (); + [CCode (array_length = false, array_null_terminated = true)] + public unowned string[] get_dependencies (); + public unowned string get_description (); + [Version (since = "1.6")] + public unowned string? get_external_data (string key); + public unowned string get_help_uri (); + public unowned string get_icon_name (); + public unowned string get_module_dir (); + public unowned string get_module_name (); + public unowned string get_name (); + public GLib.Resource get_resource (string? filename) throws GLib.Error; + [Version (since = "1.4")] + public GLib.Settings? get_settings (string? schema_id); + public unowned string get_version (); + public unowned string get_website (); + public bool has_dependency (string module_name); + public bool is_available () throws GLib.Error; + public bool is_builtin (); + public bool is_hidden (); + public bool is_loaded (); + public void load_resource (string? filename) throws GLib.Error; + [CCode (array_length = false, array_null_terminated = true)] + public string[] authors { get; } + [NoAccessorMethod] + public bool builtin { get; } + public string copyright { get; } + [CCode (array_length = false, array_null_terminated = true)] + public string[] dependencies { get; } + public string description { get; } + public string help_uri { get; } + [NoAccessorMethod] + public bool hidden { get; } + public string icon_name { get; } + [NoAccessorMethod] + public bool loaded { get; } + public string module_dir { get; } + public string module_name { get; } + public string name { get; } + public string version { get; } + public string website { get; } + } + [CCode (cheader_filename = "libpeas.h", cprefix = "PEAS_PLUGIN_INFO_ERROR_", has_type_id = false)] + public enum PluginInfoError { + LOADING_FAILED, + LOADER_NOT_FOUND, + DEP_NOT_FOUND, + DEP_LOADING_FAILED + } + [CCode (cheader_filename = "libpeas.h", has_target = false)] + public delegate void ExtensionSetForeachFunc (Peas.ExtensionSet @set, Peas.PluginInfo info, GLib.Object extension, void* data); + [CCode (cheader_filename = "libpeas.h", instance_pos = 1.9)] + public delegate GLib.Object FactoryFunc ([CCode (array_length_cname = "n_parameters", array_length_pos = 0.5, array_length_type = "guint")] GLib.Parameter[] parameters); +}