Skip to content

Commit

Permalink
Disconnect signals properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Wootten authored and Jeremy Wootten committed Dec 27, 2024
1 parent 45a18b9 commit bc81def
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions plugins/brackets-completion/brackets-completion.vala
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public class Scratch.Plugins.BracketsCompletion : Scratch.Plugins.PluginBase {
keys[Gdk.Key.quotedbl] = "\"";
keys[Gdk.Key.grave] = "`";

iface.hook_document.connect (on_hook_document);
doc_hook_handler = iface.hook_document.connect (on_hook_document);
}

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

void on_hook_document (Scratch.Services.Document doc) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/detect-indent/detect-indent.vala
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class Scratch.Plugins.DetectIndent: Scratch.Plugins.PluginBase {
}

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

Expand Down
2 changes: 1 addition & 1 deletion plugins/editorconfig/editorconfig.vala
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public class Scratch.Plugins.EditorConfigPlugin: Scratch.Plugins.PluginBase {
}

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

Expand Down
4 changes: 2 additions & 2 deletions plugins/fuzzy-search/fuzzy-search.vala
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public class Scratch.Plugins.FuzzySearch: Scratch.Plugins.PluginBase {
cancellable.cancel ();
}

this.disconnect (window_hook_handler);
this.disconnect (folder_hook_handler);
iface.disconnect (window_hook_handler);
iface.disconnect (folder_hook_handler);
}

private void add_actions () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
BEGIN LICENSE
Copyright (C) 2019-24 elementary, Inc. <https://elementary.io>
2013 Madelynn May <madelynnmay@madelynnmay.com>
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.
Expand Down Expand Up @@ -57,8 +57,8 @@ public class Scratch.Plugins.HighlightSelectedWords : Scratch.Plugins.PluginBase
current_source.selection_changed.disconnect (on_selection_changed);
}

this.disconnect (window_hook_handler);
this.disconnect (doc_hook_handler);
iface.disconnect (window_hook_handler);
iface.disconnect (doc_hook_handler);
}

public void on_selection_changed (ref Gtk.TextIter start, ref Gtk.TextIter end) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/markdown-actions/markdown-actions.vala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class Scratch.Plugins.MarkdownActions : Scratch.Plugins.PluginBase {
current_source.notify["language"].disconnect (configure_shortcuts);
}

this.disconnect (doc_hook_handler);
iface.disconnect (doc_hook_handler);
}

private void configure_shortcuts () {
Expand Down
4 changes: 2 additions & 2 deletions plugins/pastebin/pastebin.vala
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public class Scratch.Plugins.Pastebin : Scratch.Plugins.PluginBase {

protected override void deactivate_internal () {
remove_actions ();
this.disconnect (menu_hook_handler);
this.disconnect (doc_hook_handler);
iface.disconnect (menu_hook_handler);
iface.disconnect (doc_hook_handler);
}

void on_hook_share_menu (GLib.MenuModel menu) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/preserve-indent/preserve-indent.vala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class Scratch.Plugins.PreserveIndent : Scratch.Plugins.PluginBase {

protected override void deactivate_internal () {
this.documents.clear ();
this.disconnect (doc_hook_handler);
iface.disconnect (doc_hook_handler);
}

// determine how many characters precede a given iterator position
Expand Down
4 changes: 2 additions & 2 deletions plugins/spell/spell.vala
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public class Scratch.Plugins.Spell: Scratch.Plugins.PluginBase {
protected override void deactivate_internal () {
save_settings ();
window.destroy.disconnect (save_settings);
this.disconnect (window_hook_handler);
this.disconnect (doc_hook_handler);
iface.disconnect (window_hook_handler);
iface.disconnect (doc_hook_handler);
}

private void language_changed_spell (Scratch.Widgets.SourceView view) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/vim-emulation/vim-emulation.vala
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class Scratch.Plugins.VimEmulation : Scratch.Plugins.PluginBase {
v.key_press_event.disconnect (handle_key_press);
}

this.disconnect (doc_hook_handler);
iface.disconnect (doc_hook_handler);
}

private bool handle_key_press (Gdk.EventKey event) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/word-completion/plugin.vala
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ public class Scratch.Plugins.Completion : Scratch.Plugins.PluginBase {

protected override void deactivate_internal () {
text_view_list.@foreach (cleanup);
this.disconnect (window_hook_handler);
this.disconnect (doc_hook_handler);
iface.disconnect (window_hook_handler);
iface.disconnect (doc_hook_handler);
}

public void on_new_source_view (Scratch.Services.Document doc) {
Expand Down

0 comments on commit bc81def

Please sign in to comment.