Implement show all feature

This commit is contained in:
Benjamin Drieu 2022-05-30 11:27:27 +02:00
parent 7795bd3d51
commit 42d1d4f548

View File

@ -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;