Add button + change defaults
This commit is contained in:
parent
2e493e6fe7
commit
838f4012a1
32
extension.js
32
extension.js
|
@ -61,6 +61,7 @@ const column_definitions = {
|
||||||
last_check: { label: _('Last check'), width: 200, expand: false, },
|
last_check: { label: _('Last check'), width: 200, expand: false, },
|
||||||
attempts: { label: _('Attempts'), width: 50, expand: false, },
|
attempts: { label: _('Attempts'), width: 50, expand: false, },
|
||||||
status_information: { label: _('Information'), width: 600, expand: true, },
|
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._prefsButton = this._createButton ( 'preferences-system-symbolic', 'Preferences', this._onPreferencesActivate );
|
||||||
this._buttonMenu.actor.add_child (this._prefsButton);
|
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._reloadButton = this._createButton ( 'view-refresh-symbolic', 'Reload', this.updateStatus );
|
||||||
this._buttonMenu.actor.add_child (this._reloadButton );
|
this._buttonMenu.actor.add_child (this._reloadButton );
|
||||||
|
|
||||||
|
@ -254,12 +258,36 @@ class Indicator extends PanelMenu.Button {
|
||||||
}
|
}
|
||||||
|
|
||||||
createBin ( status, text, col ) {
|
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({
|
let _bin = new St.Bin({
|
||||||
style_class: 'monito-service-' + status,
|
style_class: 'monito-service-' + status,
|
||||||
track_hover: true,
|
track_hover: true,
|
||||||
width: col.width,
|
width: col.width,
|
||||||
x_expand: col.expand,
|
x_expand: col.expand,
|
||||||
child: new St.Label({ style_class: 'monito-label', text: text })
|
child: _child,
|
||||||
});
|
});
|
||||||
return _bin;
|
return _bin;
|
||||||
}
|
}
|
||||||
|
@ -284,6 +312,7 @@ class Indicator extends PanelMenu.Button {
|
||||||
let _columns = Preferences.getColumns ( this.server );
|
let _columns = Preferences.getColumns ( this.server );
|
||||||
for ( let _col of _columns )
|
for ( let _col of _columns )
|
||||||
headerBox.add_child ( this.createHeaderBin ( _col ) );
|
headerBox.add_child ( this.createHeaderBin ( _col ) );
|
||||||
|
headerBox.add_child ( this.createHeaderBin ( 'actions' ) );
|
||||||
|
|
||||||
let scrollBox = new St.ScrollView ( { hscrollbar_policy: St.PolicyType.NEVER,
|
let scrollBox = new St.ScrollView ( { hscrollbar_policy: St.PolicyType.NEVER,
|
||||||
enable_mouse_scrolling: true, } );
|
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, entry [ _col ], column_definitions [ _col ] ) );
|
||||||
}
|
}
|
||||||
|
infoBox.add_child ( this.createBin ( entry.status, '', column_definitions [ 'actions' ] ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
<key name="columns-order" type="as">
|
<key name="columns-order" type="as">
|
||||||
<default>['host_name+','service_display_name+']</default>
|
<default>['status+', 'host_name+','service_display_name+']</default>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
</schema>
|
</schema>
|
||||||
|
|
Loading…
Reference in New Issue