From d7263f491b6a04b7412d2ee55fd7f0ff6bbbabbe Mon Sep 17 00:00:00 2001 From: Benjamin Drieu Date: Mon, 30 May 2022 11:27:27 +0200 Subject: [PATCH] Implement show all feature --- extension.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/extension.js b/extension.js index 11cab08..233c268 100644 --- a/extension.js +++ b/extension.js @@ -78,8 +78,9 @@ class Indicator extends PanelMenu.Button { this.namesBoxes = { }; this.boxes = { }; - this.sortIcons = { }; + this.showAll = false; + account_settings [ server ] = Preferences.getAccountSettings ( this.server ); this.account_settings = account_settings [ server ]; @@ -165,9 +166,11 @@ class Indicator extends PanelMenu.Button { this._searchField.connect('secondary-icon-clicked', Lang.bind(this, this._onSearchFieldActivate ) ); this._searchField.clutter_text.connect('activate', Lang.bind(this, this._onSearchFieldActivate ) ); this._searchField.clutter_text.connect('text-changed', Lang.bind(this, this._onSearchFieldActivate ) ); - this._buttonMenu.actor.add_child (this._searchField); + this._showAllButton = this._createButton ( 'big', 'view-reveal-symbolic', _('Show all'), this.changeShowAll, true ); + this._buttonMenu.actor.add_child (this._showAllButton ); + this._prefsButton = this._createButton ( 'big', 'preferences-system-symbolic', _('Preferences'), this._onPreferencesActivate ); this._buttonMenu.actor.add_child (this._prefsButton); @@ -224,6 +227,12 @@ class Indicator extends PanelMenu.Button { this.serverLogic.recheckAll ( this._recheckButton ); } + changeShowAll ( ) + { + this.showAll = ! this.showAll; + this.refreshUI ( ); + } + updateStatus ( ) { this.spinChildOf ( this._reloadButton ); @@ -446,7 +455,8 @@ class Indicator extends PanelMenu.Button { entry [ 'status_information' ].toLowerCase().includes ( this._searchString ) ) ) continue; - if ( ( ! _status [ 'WARNING' ] && ! _status [ 'CRITICAL' ] && ! _status [ 'UNKNOWN' ] && entry.status == 'OK' ) || + if ( this.showAll || + ( ! _status [ 'WARNING' ] && ! _status [ 'CRITICAL' ] && ! _status [ 'UNKNOWN' ] && entry.status == 'OK' ) || ( ( _status [ 'WARNING' ] || _status [ 'CRITICAL' ] || _status [ 'UNKNOWN' ] ) && entry.status != 'OK' ) ) { let _style = this.getStyleForRow ( entry.status.toLowerCase(), _row ); @@ -632,7 +642,7 @@ class Indicator extends PanelMenu.Button { this.stopChildSpin ( e.service.button ); } - _createButton ( sizeName, icon, data, callback ) { + _createButton ( sizeName, icon, data, callback, radiobutton = false ) { let size = 24; if ( sizeName == 'small' ) size = 24; @@ -657,6 +667,9 @@ class Indicator extends PanelMenu.Button { }); button.prevIcon = icon; + button.toggle_mode = true; + button.set_checked ( true ); + if ( data instanceof Object ) button.service = data;