diff --git a/extension.js b/extension.js index ac04fd7..cd0e810 100644 --- a/extension.js +++ b/extension.js @@ -169,15 +169,23 @@ class Indicator extends PanelMenu.Button { this._prefsButton = this._createButton ( 'big', 'preferences-system-symbolic', _('Preferences'), this._onPreferencesActivate ); this._buttonMenu.actor.add_child (this._prefsButton); - if ( this.serverLogic && this.serverLogic.canRecheck ) - { - this._recheckButton = this._createButton ( 'big', 'mail-send-receive-symbolic', _('Recheck all'), this.recheckAll ); - this._buttonMenu.actor.add_child (this._recheckButton ); - } - this._reloadButton = this._createButton ( 'big', 'view-refresh-symbolic', _('Reload view'), this.updateStatus ); this._buttonMenu.actor.add_child (this._reloadButton ); + if ( this.serverLogic && this.serverLogic.canRecheck ) + { + let multiButtonBox = new St.BoxLayout( { style_class: 'monito-multibutton' } ); + this._recheckButton = this._createButton ( 'big', 'mail-send-receive-symbolic', _('Recheck all'), this.recheckAll ); + this._recheckSpecialButton = this._createPopupButton ( this.recheckSpecial ); + multiButtonBox.add_child ( this._recheckButton ); + multiButtonBox.add_child ( this._recheckSpecialButton ); + this._buttonMenu.actor.add_child (multiButtonBox); + + const sourceActor = new St.Widget(); + this._menu = new PopupMenu.PopupMenu(sourceActor, 0.0, St.Side.TOP); + const menuItem1 = this._menu.addAction('Item 1', () => console.log('activated')); + } + let _intermediate = new PopupMenu.PopupBaseMenuItem ( { style_class: 'monito-services', reactive: false @@ -222,6 +230,11 @@ class Indicator extends PanelMenu.Button { this.serverLogic.recheckAll ( this._recheckButton ); } + recheckSpecial ( ) + { + this._menu.open(); + } + changeShowAll ( ) { this.showAll = ! this.showAll; @@ -694,6 +707,28 @@ class Indicator extends PanelMenu.Button { return button; } + _createPopupButton ( callback ) { + let size = 48; + let sizeName = 'big'; + + let button = new St.Button({ + x_align: Clutter.ActorAlign.END, + y_align: Clutter.ActorAlign.CENTER, + reactive: true, + can_focus: true, + track_hover: true, + style_class: 'button %s-button'.format(sizeName), + rotation_angle_x: 0.0, + width: 32, + height: size + }); + + button.child = PopupMenu.arrowIcon(St.Side.BOTTOM); + + button.connect('clicked', Lang.bind(this, callback ) ); + return button; + } + }); class Extension {