From ef436c6ffb4b1a29a2360dd4ed784e06a8749831 Mon Sep 17 00:00:00 2001 From: Bruce Leidl Date: Sun, 13 Nov 2022 09:15:36 -0500 Subject: [PATCH] Use connectObject() and adopt to style in search.js --- js/ui/realms/realmSearchProvider.js | 39 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/js/ui/realms/realmSearchProvider.js b/js/ui/realms/realmSearchProvider.js index 00ad04d10..090af285c 100644 --- a/js/ui/realms/realmSearchProvider.js +++ b/js/ui/realms/realmSearchProvider.js @@ -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 {