Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lose libpeas dependency #1502

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Ensure activate does not re-enter
Jeremy Wootten authored and Jeremy Wootten committed Dec 27, 2024
commit 7e943c93bda9a3cae0199d391b0579da399323cc
3 changes: 2 additions & 1 deletion plugins/brackets-completion/brackets-completion.vala
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@ public class Scratch.Plugins.BracketsCompletion : Scratch.Plugins.PluginBase {
base (info, iface);
}

ulong doc_hook_handler = 0;
protected override void activate_internal () {
brackets = new Gee.HashMap<string, string> ();
brackets["("] = ")";
@@ -59,7 +60,7 @@ public class Scratch.Plugins.BracketsCompletion : Scratch.Plugins.PluginBase {
}

protected override void deactivate_internal () {
iface.hook_document.disconnect (on_hook_document);
this.disconnect (doc_hook_handler);
}

void on_hook_document (Scratch.Services.Document doc) {
Original file line number Diff line number Diff line change
@@ -35,7 +35,6 @@ public class Scratch.Plugins.HighlightSelectedWords : Scratch.Plugins.PluginBase
ulong window_hook_handler = 0;
ulong doc_hook_handler = 0;
protected override void activate_internal () {
// plugins = (Scratch.Plugins.Interface) object;
doc_hook_handler = iface.hook_document.connect ((doc) => {
if (current_source != null) {
current_source.deselected.disconnect (on_deselection);
3 changes: 0 additions & 3 deletions plugins/word-completion/plugin.vala
Original file line number Diff line number Diff line change
@@ -48,9 +48,6 @@ public class Scratch.Plugins.Completion : Scratch.Plugins.PluginBase {
ulong window_hook_handler = 0;
ulong doc_hook_handler = 0;
protected override void activate_internal () {
if (window_hook_handler > 0) {
return;
}
parser = new Euclide.Completion.Parser ();
window_hook_handler = iface.hook_window.connect ((w) => {
this.main_window = w;
8 changes: 8 additions & 0 deletions src/Services/PluginManager.vala
Original file line number Diff line number Diff line change
@@ -32,12 +32,20 @@ public abstract class Scratch.Plugins.PluginBase : GLib.Object {
}

public void activate () {
if (is_active) {
return;
}

is_active = true;
activate_internal ();
}


public void deactivate () {
if (!is_active) {
return;
}

is_active = false;
deactivate_internal ();
}