22
22
const GLib = imports.gi.GLib;
23
23
const Gtk = imports.gi.Gtk;
24
const GtkClutter = imports.gi.GtkClutter;
26
const Lang = imports.lang;
27
const Tweener = imports.util.tweener;
25
29
const _ICON_SIZE = 128;
27
function ErrorBox(primary, secondary) {
28
this._init(primary, secondary);
31
const ErrorBox = new Lang.Class({
31
ErrorBox.prototype = {
32
34
_init: function(primary, secondary) {
33
35
this.widget = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
45
47
this.widget.add(this._image);
47
49
this._primaryLabel =
48
new Gtk.Label({ label: '<big><b>' + GLib.markup_escape_text(primary, -1) + '</b></big>',
50
new Gtk.Label({ label: '',
50
52
halign: Gtk.Align.CENTER,
51
53
valign: Gtk.Align.CENTER });
52
54
this.widget.add(this._primaryLabel);
54
56
this._secondaryLabel =
55
new Gtk.Label({ label: GLib.markup_escape_text(secondary, -1),
57
new Gtk.Label({ label: '',
57
59
halign: Gtk.Align.CENTER,
58
60
valign: Gtk.Align.CENTER });
59
61
this.widget.add(this._secondaryLabel);
61
63
this.widget.show_all();
65
this.actor = new GtkClutter.Actor({ contents: this.widget,
69
update: function(primary, secondary) {
70
let primaryMarkup = '<big><b>' + GLib.markup_escape_text(primary, -1) + '</b></big>';
71
let secondaryMarkup = GLib.markup_escape_text(secondary, -1);
73
this._primaryLabel.label = primaryMarkup;
74
this._secondaryLabel.label = secondaryMarkup;
78
this.actor.raise_top();
80
Tweener.addTween(this.actor, { opacity: 255,
82
transition: 'easeOutQuad' });
86
Tweener.addTween(this.actor, { opacity: 0,
88
transition: 'easeOutQuad',
89
onComplete: function () {
90
this.actor.lower_bottom();
92
onCompleteScope: this });