js: Use (dis)connectObject()
Start using the new methods to simplify signal cleanup. For now, focus on replacing existing cleanups; in most cases this means signals connected in the constructor and disconnected on destroy, but also other cases with a similarly defined lifetime (say: from show to hide). This doesn't change signal connections that only exist for a short time (say: once), handlers that are connected on-demand (say: the first time a particular method is called), or connections that aren't tracked (read: disconnected) at all. We will eventually replace the latter with connectObject() as well - especially from actor subclasses - but the changeset is already big enough as-is :-) Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1953>
This commit is contained in:

committed by
Marge Bot

parent
f45ccc9143
commit
26235bbe54
@ -79,8 +79,6 @@ class ListSearchResult extends SearchResult {
|
||||
});
|
||||
this.set_child(content);
|
||||
|
||||
this._termsChangedId = 0;
|
||||
|
||||
let titleBox = new St.BoxLayout({
|
||||
style_class: 'list-search-result-title',
|
||||
y_align: Clutter.ActorAlign.CENTER,
|
||||
@ -108,14 +106,11 @@ class ListSearchResult extends SearchResult {
|
||||
});
|
||||
content.add_child(this._descriptionLabel);
|
||||
|
||||
this._termsChangedId =
|
||||
this._resultsView.connect('terms-changed',
|
||||
this._highlightTerms.bind(this));
|
||||
this._resultsView.connectObject(
|
||||
'terms-changed', this._highlightTerms.bind(this), this);
|
||||
|
||||
this._highlightTerms();
|
||||
}
|
||||
|
||||
this.connect('destroy', this._onDestroy.bind(this));
|
||||
}
|
||||
|
||||
get ICON_SIZE() {
|
||||
@ -126,12 +121,6 @@ class ListSearchResult extends SearchResult {
|
||||
let markup = this._resultsView.highlightTerms(this.metaInfo['description'].split('\n')[0]);
|
||||
this._descriptionLabel.clutter_text.set_markup(markup);
|
||||
}
|
||||
|
||||
_onDestroy() {
|
||||
if (this._termsChangedId)
|
||||
this._resultsView.disconnect(this._termsChangedId);
|
||||
this._termsChangedId = 0;
|
||||
}
|
||||
});
|
||||
|
||||
var GridSearchResult = GObject.registerClass(
|
||||
|
Reference in New Issue
Block a user