Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
09b30dc
First compilable version
jeremypw Dec 25, 2024
8751ab9
Emulate previous appearance of Plugins view
jeremypw Dec 25, 2024
31389a8
Update ci.yml
jeremypw Dec 25, 2024
ddfafb6
Update io.elementary.code.yml
jeremypw Dec 25, 2024
d79d046
Bump glib dependency for libpeas-2
jeremypw Dec 25, 2024
7687d4e
Rename non-functional Flatpak manifest
jeremypw Dec 25, 2024
d2e4e34
Sync checkbutton with plugin loaded on show
jeremypw Dec 25, 2024
13f6db7
Action when checkbox toggled
jeremypw Dec 25, 2024
d882fab
Fix double parenting
jeremypw Dec 25, 2024
0071f7d
Sort plugins by name
jeremypw Dec 25, 2024
37f607d
Use bind_model and factory
jeremypw Dec 25, 2024
07f83a2
Lose unused entities
jeremypw Dec 25, 2024
d2d44aa
Cleanup and code style
jeremypw Dec 25, 2024
cc2f607
Fix initial appearance of preferences dialog
jeremypw Dec 25, 2024
5939f56
Add some comments
jeremypw Dec 25, 2024
b8ef69a
Lose commented out code
jeremypw Dec 25, 2024
feb933b
Make activate and deactivate methods mandatory to implement
jeremypw Dec 25, 2024
cd945db
Fix Flatpak build for OS8
jeremypw Dec 30, 2024
45f4225
Fix libsoup3.0-dev dependency
leonardo-lemos Dec 30, 2024
da38566
Fix libsoup name
leonardo-lemos Dec 30, 2024
9ef37c1
Fix ninja build install command
leonardo-lemos Dec 30, 2024
a84fb96
Merge branch 'master' into jeremypw/migrate-libpeas-2
jeremypw Jan 12, 2025
ebe8ef5
Merge branch 'master' into jeremypw/migrate-libpeas-2
jeremypw Jan 16, 2025
d1682c4
Merge branch 'master' into jeremypw/migrate-libpeas-2
jeremypw May 6, 2025
ad6ddd3
Merge branch 'master' into jeremypw/migrate-libpeas-2
jeremypw May 9, 2025
b0dfcd6
Merge branch 'master' into jeremypw/migrate-libpeas-2
leonardo-lemos May 9, 2025
81f00c0
Merge branch 'master' into jeremypw/migrate-libpeas-2
leonardo-lemos May 9, 2025
2105164
Revert to '7.1' Sdk
jeremypw May 17, 2025
f157a1b
Update libpeas dependency in README.md
jeremypw May 17, 2025
09b23e0
Merge branch 'master' into jeremypw/migrate-libpeas-2
leonardo-lemos May 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 11 additions & 7 deletions io.elementary.code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -59,7 +58,6 @@ dependencies = [
handy_dep,
gtksourceview_dep,
peas_dep,
peasgtk_dep,
git_dep,
fontconfig_dep,
pangofc_dep,
Expand Down
4 changes: 2 additions & 2 deletions plugins/brackets-completion/brackets-completion.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> brackets;
Gee.HashMap<uint, string> keys;
const string[] VALID_NEXT_CHARS = {
Expand Down Expand Up @@ -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));
}
4 changes: 2 additions & 2 deletions plugins/detect-indent/detect-indent.vala
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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)
);
}
4 changes: 2 additions & 2 deletions plugins/editorconfig/editorconfig.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
4 changes: 2 additions & 2 deletions plugins/fuzzy-search/fuzzy-search.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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));
}
4 changes: 2 additions & 2 deletions plugins/markdown-actions/markdown-actions.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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));
}
2 changes: 1 addition & 1 deletion plugins/pastebin/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module_files = [
'pastebin.vala'
]

soup_dep = dependency('libsoup-2.4')
soup_dep = dependency('libsoup-3.0')

module_deps = [
codecore_dep,
Expand Down
21 changes: 14 additions & 7 deletions plugins/pastebin/pastebin.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;
}
Expand All @@ -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; }
Expand Down Expand Up @@ -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));
}
4 changes: 2 additions & 2 deletions plugins/preserve-indent/preserve-indent.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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<weak Services.Document> documents;
Expand Down Expand Up @@ -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));
}
4 changes: 2 additions & 2 deletions plugins/spell/spell.vala
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>
*/

public class Scratch.Plugins.Spell: Peas.ExtensionBase, Peas.Activatable {
public class Scratch.Plugins.Spell: Peas.ExtensionBase, Scratch.Services.ActivatablePlugin {

Scratch.Services.Interface plugins;

Expand Down Expand Up @@ -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)
);
}
4 changes: 2 additions & 2 deletions plugins/vim-emulation/vim-emulation.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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));
}
4 changes: 2 additions & 2 deletions plugins/word-completion/plugin.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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));
}
9 changes: 7 additions & 2 deletions src/Dialogs/PreferencesDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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 {
Expand Down
Loading