2
* Copyright (c) 2011 Red Hat, Inc.
4
* Gnome Documents is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by the
6
* Free Software Foundation; either version 2 of the License, or (at your
7
* option) any later version.
9
* Gnome Documents is distributed in the hope that it will be useful, but
10
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* You should have received a copy of the GNU General Public License along
15
* with Gnome Documents; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
* Author: Cosimo Cecchi <cosimoc@redhat.com>
22
const GLib = imports.gi.GLib;
23
const Gtk = imports.gi.Gtk;
24
const GtkClutter = imports.gi.GtkClutter;
26
const Lang = imports.lang;
27
const Tweener = imports.util.tweener;
29
const _ICON_SIZE = 128;
31
const ErrorBox = new Lang.Class({
34
_init: function(primary, secondary) {
35
this.widget = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
39
halign: Gtk.Align.CENTER,
40
valign: Gtk.Align.CENTER });
42
this._image = new Gtk.Image({ pixel_size: _ICON_SIZE,
43
icon_name: 'dialog-error',
44
halign: Gtk.Align.CENTER,
45
valign: Gtk.Align.CENTER });
47
this.widget.add(this._image);
50
new Gtk.Label({ label: '',
52
halign: Gtk.Align.CENTER,
53
valign: Gtk.Align.CENTER });
54
this.widget.add(this._primaryLabel);
56
this._secondaryLabel =
57
new Gtk.Label({ label: '',
59
halign: Gtk.Align.CENTER,
60
valign: Gtk.Align.CENTER });
61
this.widget.add(this._secondaryLabel);
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 });