~ubuntu-branches/ubuntu/quantal/gnome-documents/quantal

« back to all changes in this revision

Viewing changes to src/errorBox.js

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2012-06-29 13:16:35 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120629131635-tkocc51xk4c37a39
Tags: 0.5.3-0ubuntu1
* New upstream release.
* debian/control.in:
  - Bump minimum GTK
  - Build-depend on libzapojit-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
const GLib = imports.gi.GLib;
23
23
const Gtk = imports.gi.Gtk;
 
24
const GtkClutter = imports.gi.GtkClutter;
 
25
 
 
26
const Lang = imports.lang;
 
27
const Tweener = imports.util.tweener;
24
28
 
25
29
const _ICON_SIZE = 128;
26
30
 
27
 
function ErrorBox(primary, secondary) {
28
 
    this._init(primary, secondary);
29
 
}
 
31
const ErrorBox = new Lang.Class({
 
32
    Name: 'ErrorBox',
30
33
 
31
 
ErrorBox.prototype = {
32
34
    _init: function(primary, secondary) {
33
35
        this.widget = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL,
34
36
                                     row_spacing: 12,
45
47
        this.widget.add(this._image);
46
48
 
47
49
        this._primaryLabel =
48
 
            new Gtk.Label({ label: '<big><b>' + GLib.markup_escape_text(primary, -1) + '</b></big>',
 
50
            new Gtk.Label({ label: '',
49
51
                            use_markup: true,
50
52
                            halign: Gtk.Align.CENTER,
51
53
                            valign: Gtk.Align.CENTER });
52
54
        this.widget.add(this._primaryLabel);
53
55
 
54
56
        this._secondaryLabel =
55
 
            new Gtk.Label({ label: GLib.markup_escape_text(secondary, -1),
 
57
            new Gtk.Label({ label: '',
56
58
                            use_markup: true,
57
59
                            halign: Gtk.Align.CENTER,
58
60
                            valign: Gtk.Align.CENTER });
59
61
        this.widget.add(this._secondaryLabel);
60
62
 
61
63
        this.widget.show_all();
 
64
 
 
65
        this.actor = new GtkClutter.Actor({ contents: this.widget,
 
66
                                            opacity: 255 });
 
67
    },
 
68
 
 
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);
 
72
 
 
73
        this._primaryLabel.label = primaryMarkup;
 
74
        this._secondaryLabel.label = secondaryMarkup;
 
75
    },
 
76
 
 
77
    moveIn: function() {
 
78
        this.actor.raise_top();
 
79
 
 
80
        Tweener.addTween(this.actor, { opacity: 255,
 
81
                                       time: 0.30,
 
82
                                       transition: 'easeOutQuad' });
 
83
    },
 
84
 
 
85
    moveOut: function() {
 
86
        Tweener.addTween(this.actor, { opacity: 0,
 
87
                                       time: 0.30,
 
88
                                       transition: 'easeOutQuad',
 
89
                                       onComplete: function () {
 
90
                                           this.actor.lower_bottom();
 
91
                                       },
 
92
                                       onCompleteScope: this });
62
93
    }
63
 
};
 
94
});