|
|
|
@ -168,16 +168,16 @@ class Indicator extends PanelMenu.Button {
|
|
|
|
|
|
|
|
|
|
this._buttonMenu.actor.add_child (this._searchField);
|
|
|
|
|
|
|
|
|
|
this._prefsButton = this._createButton ( 'preferences-system-symbolic', _('Preferences'), this._onPreferencesActivate );
|
|
|
|
|
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 ( 'mail-send-receive-symbolic', _('Recheck all'), this.recheckAll );
|
|
|
|
|
this._recheckButton = this._createButton ( 'big', 'mail-send-receive-symbolic', _('Recheck all'), this.recheckAll );
|
|
|
|
|
this._buttonMenu.actor.add_child (this._recheckButton );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this._reloadButton = this._createButton ( 'view-refresh-symbolic', _('Reload view'), this.updateStatus );
|
|
|
|
|
this._reloadButton = this._createButton ( 'big', 'view-refresh-symbolic', _('Reload view'), this.updateStatus );
|
|
|
|
|
this._buttonMenu.actor.add_child (this._reloadButton );
|
|
|
|
|
|
|
|
|
|
let _intermediate = new PopupMenu.PopupBaseMenuItem ( {
|
|
|
|
@ -330,35 +330,31 @@ class Indicator extends PanelMenu.Button {
|
|
|
|
|
text = '…';
|
|
|
|
|
|
|
|
|
|
if ( ! col [ 'special' ] )
|
|
|
|
|
{
|
|
|
|
|
_child = new St.Label ( { style_class: 'monito-label',
|
|
|
|
|
reactive: true,
|
|
|
|
|
can_focus: true,
|
|
|
|
|
track_hover: true,
|
|
|
|
|
width: col.width,
|
|
|
|
|
text: text.toString(),
|
|
|
|
|
text: text.toString().replace(/\n.*/s, ''),
|
|
|
|
|
x_align: ( col.align ? col.align : Clutter.ActorAlign.START ),
|
|
|
|
|
style: ( col.style ? col.style : '' ) } );
|
|
|
|
|
else if ( col.special == 'actions' && this.serverLogic.canRecheck )
|
|
|
|
|
_child.original_text = text.toString();
|
|
|
|
|
_child.connect('button-press-event', Lang.bind(this, this._onExpandLabel ) );
|
|
|
|
|
_child.connect('notify::hover', Lang.bind(this, this._onEnterEvent ) );
|
|
|
|
|
}
|
|
|
|
|
else if ( col.special == 'actions' )
|
|
|
|
|
{
|
|
|
|
|
_child = new St.BoxLayout ( { x_expand: true,
|
|
|
|
|
vertical: false,
|
|
|
|
|
width: col.width, } );
|
|
|
|
|
let _button = new St.Button ( {
|
|
|
|
|
style_class: 'button small-button',
|
|
|
|
|
x_expand: true,
|
|
|
|
|
x_align: Clutter.ActorAlign.END,
|
|
|
|
|
y_align: Clutter.ActorAlign.CENTER,
|
|
|
|
|
width: 24,
|
|
|
|
|
height: 24,
|
|
|
|
|
can_focus: true,
|
|
|
|
|
} );
|
|
|
|
|
_button.prevIcon = 'mail-send-receive-symbolic';
|
|
|
|
|
_button.service = text;
|
|
|
|
|
_button.connect ( 'clicked', Lang.bind ( this, this._onRecheckButtonClick ) );
|
|
|
|
|
_button.child = new St.Icon ( {
|
|
|
|
|
icon_name: 'mail-send-receive-symbolic',
|
|
|
|
|
icon_size: 16,
|
|
|
|
|
width: 16,
|
|
|
|
|
height: 16,
|
|
|
|
|
} );
|
|
|
|
|
_child.add_child ( _button );
|
|
|
|
|
|
|
|
|
|
if ( this.serverLogic.canRecheck )
|
|
|
|
|
{
|
|
|
|
|
_child.add_child ( this._createButton ( 'small', 'mail-send-receive-symbolic', text, this._onRecheckButtonClick ) );
|
|
|
|
|
}
|
|
|
|
|
_child.add_child ( this._createButton ( 'small', 'web-browser-symbolic', text, this._onOpenInBrowser ) );
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let _bin = new St.Bin({
|
|
|
|
@ -457,8 +453,10 @@ class Indicator extends PanelMenu.Button {
|
|
|
|
|
let infoBox = new St.BoxLayout({
|
|
|
|
|
style_class: 'monito-service-line',
|
|
|
|
|
style: _style,
|
|
|
|
|
track_hover: true,
|
|
|
|
|
x_expand: true,
|
|
|
|
|
reactive: true,
|
|
|
|
|
can_focus: true,
|
|
|
|
|
track_hover: true,
|
|
|
|
|
});
|
|
|
|
|
tableBox.add_child(infoBox);
|
|
|
|
|
|
|
|
|
@ -485,8 +483,7 @@ class Indicator extends PanelMenu.Button {
|
|
|
|
|
|
|
|
|
|
infoBox.add_child ( this.createBin ( entry.status, entry [ _col ], column_definitions [ _col ] ) );
|
|
|
|
|
}
|
|
|
|
|
if ( this.serverLogic.canRecheck )
|
|
|
|
|
infoBox.add_child ( this.createBin ( entry.status, entry, column_definitions [ 'actions' ] ) );
|
|
|
|
|
infoBox.add_child ( this.createBin ( entry.status, entry, column_definitions [ 'actions' ] ) );
|
|
|
|
|
|
|
|
|
|
_row ++;
|
|
|
|
|
}
|
|
|
|
@ -578,25 +575,101 @@ class Indicator extends PanelMenu.Button {
|
|
|
|
|
this.serverLogic.recheck ( e.service );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_createButton ( icon, text, callback ) {
|
|
|
|
|
_onExpandLabel ( e )
|
|
|
|
|
{
|
|
|
|
|
log ( "Monito: Click label " + e.original_text );
|
|
|
|
|
let temp = e.text;
|
|
|
|
|
e.text = e.original_text;
|
|
|
|
|
e.original_text = temp;
|
|
|
|
|
if ( e.clutter_text.line_wrap )
|
|
|
|
|
{
|
|
|
|
|
e.clutter_text.line_wrap = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
e.clutter_text.line_wrap = true;
|
|
|
|
|
e.clutter_text.line_wrap_mode = Pango.WrapMode.WORD;
|
|
|
|
|
e.clutter_text.ellipsize = Pango.EllipsizeMode.NONE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_onEnterEvent ( e )
|
|
|
|
|
{
|
|
|
|
|
log ( "Monito: enter");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_onOpenInBrowser ( e )
|
|
|
|
|
{
|
|
|
|
|
this.spinChildOf ( e );
|
|
|
|
|
e.service.button = e;
|
|
|
|
|
|
|
|
|
|
let loop = GLib.MainLoop.new(null, false);
|
|
|
|
|
try {
|
|
|
|
|
let _cmd = "%s %s".format(settings.get_string ( "web-browser" ), this.serverLogic.getUrlForService ( e.service ) );
|
|
|
|
|
let proc = Gio.Subprocess.new (
|
|
|
|
|
_cmd.split ( ' ' ),
|
|
|
|
|
Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_PIPE
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
let cancellable = new Gio.Cancellable();
|
|
|
|
|
proc.wait_async(cancellable, (proc, result) => {
|
|
|
|
|
try {
|
|
|
|
|
proc.wait_finish(result);
|
|
|
|
|
|
|
|
|
|
if (proc.get_successful()) {
|
|
|
|
|
log ( 'Monito: the process succeeded');
|
|
|
|
|
} else {
|
|
|
|
|
log ( 'Monito: the process failed' );
|
|
|
|
|
}
|
|
|
|
|
this.stopChildSpin ( e.service.button );
|
|
|
|
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
logError(e);
|
|
|
|
|
} finally {
|
|
|
|
|
loop.quit();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
log ( 'Monito: ' + proc );
|
|
|
|
|
} catch ( e ) {
|
|
|
|
|
log ( 'Monito: ' + e );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_createButton ( sizeName, icon, data, callback ) {
|
|
|
|
|
let size = 24;
|
|
|
|
|
if ( sizeName == 'small' )
|
|
|
|
|
size = 24;
|
|
|
|
|
else if ( sizeName == 'big' )
|
|
|
|
|
size = 32;
|
|
|
|
|
|
|
|
|
|
let _text = '';
|
|
|
|
|
if ( ! data instanceof Object )
|
|
|
|
|
_text = data;
|
|
|
|
|
|
|
|
|
|
let button = new St.Button({
|
|
|
|
|
x_align: Clutter.ActorAlign.END,
|
|
|
|
|
y_align: Clutter.ActorAlign.CENTER,
|
|
|
|
|
reactive: true,
|
|
|
|
|
can_focus: true,
|
|
|
|
|
track_hover: true,
|
|
|
|
|
accessible_name: text,
|
|
|
|
|
style_class: 'button big-button',
|
|
|
|
|
accessible_name: _text,
|
|
|
|
|
style_class: 'button %s-button'.format(sizeName),
|
|
|
|
|
rotation_angle_x: 0.0,
|
|
|
|
|
// width: size,
|
|
|
|
|
// height: size
|
|
|
|
|
});
|
|
|
|
|
button.prevIcon = icon;
|
|
|
|
|
|
|
|
|
|
if ( data instanceof Object )
|
|
|
|
|
button.service = data;
|
|
|
|
|
|
|
|
|
|
button.child = new St.Icon({
|
|
|
|
|
style_class: 'monito-button-icon',
|
|
|
|
|
icon_name: icon,
|
|
|
|
|
icon_size: 24,
|
|
|
|
|
width: 24,
|
|
|
|
|
height: 24,
|
|
|
|
|
icon_size: size - 4,
|
|
|
|
|
width: size - 4,
|
|
|
|
|
height: size - 4
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
button.connect('clicked', Lang.bind(this, callback ) );
|
|
|
|
|