diff --git a/extension.js b/extension.js index 5ab724f..fbfde89 100644 --- a/extension.js +++ b/extension.js @@ -61,6 +61,7 @@ const column_definitions = { last_check: { label: _('Last check'), width: 200, expand: false, }, attempts: { label: _('Attempts'), width: 50, expand: false, }, status_information: { label: _('Information'), width: 600, expand: true, }, + actions: { label: 'Actions', width: 100, expand: true, special: 'actions' }, }; @@ -150,6 +151,9 @@ class Indicator extends PanelMenu.Button { this._prefsButton = this._createButton ( 'preferences-system-symbolic', 'Preferences', this._onPreferencesActivate ); this._buttonMenu.actor.add_child (this._prefsButton); + this._updateButton = this._createButton ( 'mail-send-receive-symbolic', 'Reload', this.updateStatus ); // Implement this + this._buttonMenu.actor.add_child (this._updateButton ); + this._reloadButton = this._createButton ( 'view-refresh-symbolic', 'Reload', this.updateStatus ); this._buttonMenu.actor.add_child (this._reloadButton ); @@ -254,12 +258,36 @@ class Indicator extends PanelMenu.Button { } createBin ( status, text, col ) { + let _child; + + if ( ! col [ 'special' ] ) + _child = new St.Label({ style_class: 'monito-label', text: text }); + else if ( col.special == 'actions' ) + { + _child = new St.BoxLayout ( { x_expand: true, + x_align: Clutter.ActorAlign.FILL, + vertical: false } ); + let _button = new St.Button ( { + x_align: Clutter.ActorAlign.END, + y_align: Clutter.ActorAlign.CENTER, + can_focus: true, + track_hover: true, + } ); + _button.child = new St.Icon ( { + icon_name: 'view-refresh-symbolic', + icon_size: 16, + width: 16, + height: 16, + } ); + _child.add_child ( _button ); + } + let _bin = new St.Bin({ style_class: 'monito-service-' + status, track_hover: true, width: col.width, x_expand: col.expand, - child: new St.Label({ style_class: 'monito-label', text: text }) + child: _child, }); return _bin; } @@ -284,6 +312,7 @@ class Indicator extends PanelMenu.Button { let _columns = Preferences.getColumns ( this.server ); for ( let _col of _columns ) headerBox.add_child ( this.createHeaderBin ( _col ) ); + headerBox.add_child ( this.createHeaderBin ( 'actions' ) ); let scrollBox = new St.ScrollView ( { hscrollbar_policy: St.PolicyType.NEVER, enable_mouse_scrolling: true, } ); @@ -313,6 +342,7 @@ class Indicator extends PanelMenu.Button { { infoBox.add_child ( this.createBin ( entry.status, entry [ _col ], column_definitions [ _col ] ) ); } + infoBox.add_child ( this.createBin ( entry.status, '', column_definitions [ 'actions' ] ) ); } } diff --git a/schemas/org.gnome.shell.extensions.monito@drieu.org.gschema.xml b/schemas/org.gnome.shell.extensions.monito@drieu.org.gschema.xml index 95bdcf0..13128c4 100644 --- a/schemas/org.gnome.shell.extensions.monito@drieu.org.gschema.xml +++ b/schemas/org.gnome.shell.extensions.monito@drieu.org.gschema.xml @@ -97,7 +97,7 @@ - ['host_name+','service_display_name+'] + ['status+', 'host_name+','service_display_name+']