Use connectObject() and adopt to style in search.js

This commit is contained in:
Bruce Leidl 2022-11-13 09:15:36 -05:00
parent e5148151c6
commit 9312e89e0c

View File

@ -17,16 +17,22 @@ class RealmProviderInfo extends St.Button {
y_align: Clutter.ActorAlign.START,
});
this._content = new St.BoxLayout({ vertical: false,
style_class: 'list-search-provider-content' });
this._content = new St.BoxLayout({
vertical: false,
style_class: 'list-search-provider-content'
});
this.set_child(this._content);
let icon = new St.Icon({ icon_size: this.PROVIDER_ICON_SIZE,
icon_name: 'computer' });
let icon = new St.Icon({
icon_size: this.PROVIDER_ICON_SIZE,
icon_name: 'computer'
});
let detailsBox = new St.BoxLayout({ style_class: 'list-search-provider-details',
let detailsBox = new St.BoxLayout({
style_class: 'list-search-provider-details',
vertical: true,
x_expand: true });
x_expand: true
});
let nameLabel = new St.Label({
text: "Realms",
@ -72,8 +78,6 @@ class ListSearchResult extends Search.SearchResult {
});
this.set_child(content);
this._termsChangedId = 0;
let titleBox = new St.BoxLayout({
style_class: 'list-search-result-title',
y_align: Clutter.ActorAlign.CENTER,
@ -104,13 +108,16 @@ class ListSearchResult extends Search.SearchResult {
this._descriptionLabel.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
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._createConfigButton(content);
}
_createConfigButton(content) {
let id = this.metaInfo['id'];
if (id != ':new:') {
@ -129,10 +136,9 @@ class ListSearchResult extends Search.SearchResult {
Main.overview.toggle();
Util.spawn(['/usr/libexec/realm-config-ui', id]);
});
content.add_child(this.configButton);
}
this.connect('destroy', this._onDestroy.bind(this));
}
get ICON_SIZE() {
@ -143,12 +149,6 @@ class ListSearchResult extends Search.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;
}
});
// Based on ListSearchResults in search.js
@ -203,7 +203,6 @@ class RealmSearchResults extends Search.SearchResultsBase {
else
return null;
}
});
var RealmSearchProvider = class RealmSearchProvider {