Skip to content

Commit 79d8049

Browse files
Migrate to libpeas-2 (#1501)
* First compilable version * Emulate previous appearance of Plugins view * Update ci.yml * Update io.elementary.code.yml * Bump glib dependency for libpeas-2 * Rename non-functional Flatpak manifest * Sync checkbutton with plugin loaded on show * Action when checkbox toggled * Fix double parenting * Sort plugins by name * Use bind_model and factory * Lose unused entities * Cleanup and code style * Fix initial appearance of preferences dialog * Add some comments * Lose commented out code * Make activate and deactivate methods mandatory to implement * Fix Flatpak build for OS8 * Fix libsoup3.0-dev dependency * Fix libsoup name * Fix ninja build install command * Revert to '7.1' Sdk * Update libpeas dependency in README.md --------- Co-authored-by: Leonardo Lemos <[email protected]>
1 parent fa76de2 commit 79d8049

File tree

19 files changed

+302
-69
lines changed

19 files changed

+302
-69
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Install Dependencies
2323
run: |
2424
apt update
25-
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
25+
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
2626
- name: Build
2727
env:
2828
DESTDIR: out

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ You'll need the following dependencies:
1515
* libgtkspell3-3-dev
1616
* libgranite-dev >= 6.0.0
1717
* libhandy-1-dev >= 0.90.0
18-
* libpeas-dev
18+
* libpeas-2-dev
1919
* libsoup2.4-dev
2020
* libvala-0.48-dev (or higher)
2121
* libvte-2.91-dev

io.elementary.code.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,20 @@ modules:
3333
url: https://gitlab.gnome.org/GNOME/gtksourceview.git
3434
tag: '4.8.4'
3535

36-
- name: peas
36+
- name: libpeas
3737
buildsystem: meson
3838
config-opts:
39-
- '-Dgtk_doc=false'
40-
- '-Ddemos=false'
41-
- '-Dvapi=true'
39+
- -Dlua51=false
40+
- -Dgjs=false
4241
sources:
43-
- type: git
44-
url: https://gitlab.gnome.org/GNOME/libpeas.git
45-
tag: libpeas-1.34.0
42+
- type: archive
43+
url: https://download.gnome.org/sources/libpeas/2.0/libpeas-2.0.5.tar.xz
44+
sha256: 376f2f73d731b54e13ddbab1d91b6382cf6a980524def44df62add15489de6dd
45+
x-checker-data:
46+
type: gnome
47+
versions:
48+
<: '2.0.6'
49+
name: libpeas
4650

4751
- name: git2-glib
4852
buildsystem: meson

meson.build

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,14 @@ pluginsdir = get_option('prefix') / get_option('libdir') / meson.project_name()
2626
gnome = import('gnome')
2727
i18n = import('i18n')
2828

29-
glib_dep = dependency('glib-2.0', version: '>=2.30.0')
29+
glib_dep = dependency('glib-2.0', version: '>=2.74.0')
3030
gio_unix_dep = dependency('gio-unix-2.0', version: '>=2.20')
3131
gee_dep = dependency('gee-0.8', version: '>=0.8.5')
3232
gtk_dep = dependency('gtk+-3.0', version: '>=3.6.0')
3333
granite_dep = dependency('granite', version: '>=6.0.0')
3434
handy_dep = dependency('libhandy-1', version: '>=0.90.0')
3535
gtksourceview_dep = dependency('gtksourceview-4')
36-
peas_dep = dependency('libpeas-1.0')
37-
peasgtk_dep = dependency('libpeas-gtk-1.0')
36+
peas_dep = dependency('libpeas-2')
3837
git_dep = dependency('libgit2-glib-1.0')
3938
fontconfig_dep = dependency('fontconfig')
4039
pangofc_dep = dependency('pangoft2')
@@ -59,7 +58,6 @@ dependencies = [
5958
handy_dep,
6059
gtksourceview_dep,
6160
peas_dep,
62-
peasgtk_dep,
6361
git_dep,
6462
fontconfig_dep,
6563
pangofc_dep,

plugins/brackets-completion/brackets-completion.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
END LICENSE
1919
***/
2020

21-
public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Peas.Activatable {
21+
public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Scratch.Services.ActivatablePlugin {
2222
Gee.HashMap<string, string> brackets;
2323
Gee.HashMap<uint, string> keys;
2424
const string[] VALID_NEXT_CHARS = {
@@ -278,6 +278,6 @@ public class Scratch.Plugins.BracketsCompletion : Peas.ExtensionBase, Peas.Activ
278278
[ModuleInit]
279279
public void peas_register_types (GLib.TypeModule module) {
280280
var objmodule = module as Peas.ObjectModule;
281-
objmodule.register_extension_type (typeof (Peas.Activatable),
281+
objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin),
282282
typeof (Scratch.Plugins.BracketsCompletion));
283283
}

plugins/detect-indent/detect-indent.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
public class Scratch.Plugins.DetectIndent: Peas.ExtensionBase, Peas.Activatable {
1+
public class Scratch.Plugins.DetectIndent: Peas.ExtensionBase, Scratch.Services.ActivatablePlugin {
22
const int MAX_LINES = 500;
33

44
Scratch.Services.Interface plugins;
@@ -79,7 +79,7 @@ public class Scratch.Plugins.DetectIndent: Peas.ExtensionBase, Peas.Activatable
7979
public void peas_register_types (GLib.TypeModule module) {
8080
var objmodule = module as Peas.ObjectModule;
8181
objmodule.register_extension_type (
82-
typeof (Peas.Activatable),
82+
typeof (Scratch.Services.ActivatablePlugin),
8383
typeof (Scratch.Plugins.DetectIndent)
8484
);
8585
}

plugins/editorconfig/editorconfig.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* Boston, MA 02110-1301 USA
1818
*/
1919

20-
public class Scratch.Plugins.EditorConfigPlugin: Peas.ExtensionBase, Peas.Activatable {
20+
public class Scratch.Plugins.EditorConfigPlugin: Peas.ExtensionBase, Scratch.Services.ActivatablePlugin {
2121
Scratch.Services.Interface plugins;
2222
public Object object { owned get; construct; }
2323
private Code.FormatBar format_bar;
@@ -96,5 +96,5 @@ public class Scratch.Plugins.EditorConfigPlugin: Peas.ExtensionBase, Peas.Activa
9696
[ModuleInit]
9797
public void peas_register_types (GLib.TypeModule module) {
9898
var objmodule = module as Peas.ObjectModule;
99-
objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.EditorConfigPlugin));
99+
objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin), typeof (Scratch.Plugins.EditorConfigPlugin));
100100
}

plugins/fuzzy-search/fuzzy-search.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88

9-
public class Scratch.Plugins.FuzzySearch: Peas.ExtensionBase, Peas.Activatable {
9+
public class Scratch.Plugins.FuzzySearch: Peas.ExtensionBase, Scratch.Services.ActivatablePlugin {
1010
public Object object { owned get; construct; }
1111
private const uint ACCEL_KEY = Gdk.Key.F;
1212
private const Gdk.ModifierType ACCEL_MODTYPE = Gdk.ModifierType.MOD1_MASK;
@@ -158,7 +158,7 @@ public class Scratch.Plugins.FuzzySearch: Peas.ExtensionBase, Peas.Activatable {
158158
public void peas_register_types (GLib.TypeModule module) {
159159
var objmodule = module as Peas.ObjectModule;
160160
objmodule.register_extension_type (
161-
typeof (Peas.Activatable),
161+
typeof (Scratch.Services.ActivatablePlugin),
162162
typeof (Scratch.Plugins.FuzzySearch)
163163
);
164164
}

plugins/highlight-word-selection/highlight-word-selection.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
END LICENSE
1919
***/
2020

21-
public class Scratch.Plugins.HighlightSelectedWords : Peas.ExtensionBase, Peas.Activatable {
21+
public class Scratch.Plugins.HighlightSelectedWords : Peas.ExtensionBase, Scratch.Services.ActivatablePlugin {
2222
Scratch.Widgets.SourceView current_source;
2323
Scratch.MainWindow? main_window = null;
2424
Gtk.SourceSearchContext? current_search_context = null;
@@ -145,6 +145,6 @@ public class Scratch.Plugins.HighlightSelectedWords : Peas.ExtensionBase, Peas.A
145145
[ModuleInit]
146146
public void peas_register_types (TypeModule module) {
147147
var objmodule = module as Peas.ObjectModule;
148-
objmodule.register_extension_type (typeof (Peas.Activatable),
148+
objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin),
149149
typeof (Scratch.Plugins.HighlightSelectedWords));
150150
}

plugins/markdown-actions/markdown-actions.vala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
END LICENSE
1919
***/
2020

21-
public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Peas.Activatable {
21+
public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Scratch.Services.ActivatablePlugin {
2222
Scratch.Widgets.SourceView current_source;
2323
Scratch.Services.Interface plugins;
2424

@@ -243,6 +243,6 @@ public class Code.Plugins.MarkdownActions : Peas.ExtensionBase, Peas.Activatable
243243
[ModuleInit]
244244
public void peas_register_types (TypeModule module) {
245245
var objmodule = module as Peas.ObjectModule;
246-
objmodule.register_extension_type (typeof (Peas.Activatable),
246+
objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin),
247247
typeof (Code.Plugins.MarkdownActions));
248248
}

0 commit comments

Comments
 (0)