Skip to content

Commit 90cd82e

Browse files
authored
Fix Sourcelist, DnD and events for Gtk4 port - stage 1 (#2)
* 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 ci.yml * Add libgit2-glib-1.0-dev to ci.yml * Split SourceList into one file per class * Fix changed namespace * Remove DnD code * Replace Gdk.EventKey * Use GestureClick * Handle showing context menu * Handle search_entry focus in * Handle window close request
1 parent 923fc28 commit 90cd82e

32 files changed

+2618
-2786
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ 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 libgranite-7-dev libgtk-4-dev libgtksourceview-5-dev libgtkspell3-3-dev libadwaita-1-dev libpeas-2-dev libsoup-3.0-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 libgranite-7-dev libgtk-4-dev libgtksourceview-5-dev libgtkspell3-3-dev libadwaita-1-dev libpeas-2-dev libsoup2.4-dev libvala-dev libvte-2.91-gtk4-dev meson valac polkitd libpolkit-gobject-1-dev libgit2-glib-1.0-dev
26+
2627
- name: Build
2728
env:
2829
DESTDIR: out

io.elementary.code.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
app-id: io.elementary.code
22
runtime: io.elementary.Sdk # The outline plugin requires libvala which is only in the SDK, not the runtime
3-
runtime-version: "7.1"
3+
runtime-version: 'daily'
44
sdk: io.elementary.Sdk
55
command: io.elementary.code
66
finish-args:
@@ -31,7 +31,22 @@ modules:
3131
sources:
3232
- type: git
3333
url: https://gitlab.gnome.org/GNOME/gtksourceview.git
34-
tag: "4.8.4"
34+
tag: '4.8.4'
35+
36+
- name: libpeas
37+
buildsystem: meson
38+
config-opts:
39+
- -Dlua51=false
40+
- -Dgjs=false
41+
sources:
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
3550

3651
- name: git2-glib
3752
buildsystem: meson

meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ gtk_dep = dependency('gtk4', version: '>=4.14.2')
3333
granite_dep = dependency('granite-7', version: '>=7.0.0')
3434
adwaita_dep = dependency('libadwaita-1', version: '>=1.0.0')
3535
gtksourceview_dep = dependency('gtksourceview-5')
36+
peas_dep = dependency('libpeas-2')
3637
git_dep = dependency('libgit2-glib-1.0')
3738
fontconfig_dep = dependency('fontconfig')
3839
pangofc_dep = dependency('pangoft2')
@@ -56,6 +57,7 @@ dependencies = [
5657
granite_dep,
5758
adwaita_dep,
5859
gtksourceview_dep,
60+
peas_dep,
5961
git_dep,
6062
fontconfig_dep,
6163
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;
@@ -91,5 +91,5 @@ public class Scratch.Plugins.EditorConfigPlugin: Peas.ExtensionBase, Peas.Activa
9191
[ModuleInit]
9292
public void peas_register_types (GLib.TypeModule module) {
9393
var objmodule = module as Peas.ObjectModule;
94-
objmodule.register_extension_type (typeof (Peas.Activatable), typeof (Scratch.Plugins.EditorConfigPlugin));
94+
objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin), typeof (Scratch.Plugins.EditorConfigPlugin));
9595
}

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;
@@ -151,6 +151,6 @@ public class Scratch.Plugins.HighlightSelectedWords : Peas.ExtensionBase, Peas.A
151151
[ModuleInit]
152152
public void peas_register_types (TypeModule module) {
153153
var objmodule = module as Peas.ObjectModule;
154-
objmodule.register_extension_type (typeof (Peas.Activatable),
154+
objmodule.register_extension_type (typeof (Scratch.Services.ActivatablePlugin),
155155
typeof (Scratch.Plugins.HighlightSelectedWords));
156156
}

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
}

plugins/pastebin/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module_files = [
55
'pastebin.vala'
66
]
77

8-
soup_dep = dependency('libsoup-2.4')
8+
soup_dep = dependency('libsoup-3.0')
99

1010
module_deps = [
1111
codecore_dep,

0 commit comments

Comments
 (0)