~darkxst/ubuntu/quantal/gnome-shell/lp1128804

« back to all changes in this revision

Viewing changes to js/ui/lightbox.js

  • Committer: Package Import Robot
  • Author(s): Tim Lunn
  • Date: 2012-10-09 20:42:33 UTC
  • mfrom: (57.1.7 quantal)
  • Revision ID: package-import@ubuntu.com-20121009204233-chcl8989muuzfpws
Tags: 3.6.0-0ubuntu3
* debian/patches/ubuntu-lightdm-user-switching.patch
  - Fix user switching when running lightdm.  LP: #1064269
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
const Params = imports.misc.params;
9
9
const Tweener = imports.ui.tweener;
10
10
 
 
11
const DEFAULT_FADE_FACTOR = 0.4;
 
12
 
11
13
/**
12
14
 * Lightbox:
13
15
 * @container: parent Clutter.Container
15
17
 *           - inhibitEvents: whether to inhibit events for @container
16
18
 *           - width: shade actor width
17
19
 *           - height: shade actor height
18
 
 *           - fadeTime: seconds used to fade in/out
 
20
 *           - fadeInTime: seconds used to fade in
 
21
 *           - fadeOutTime: seconds used to fade out
19
22
 *
20
23
 * Lightbox creates a dark translucent "shade" actor to hide the
21
24
 * contents of @container, and allows you to specify particular actors
38
41
        params = Params.parse(params, { inhibitEvents: false,
39
42
                                        width: null,
40
43
                                        height: null,
41
 
                                        fadeTime: null
 
44
                                        fadeInTime: null,
 
45
                                        fadeOutTime: null,
 
46
                                        fadeFactor: DEFAULT_FADE_FACTOR
42
47
                                      });
43
48
 
44
49
        this._container = container;
45
50
        this._children = container.get_children();
46
 
        this._fadeTime = params.fadeTime;
 
51
        this._fadeInTime = params.fadeInTime;
 
52
        this._fadeOutTime = params.fadeOutTime;
 
53
        this._fadeFactor = params.fadeFactor;
47
54
        this.actor = new St.Bin({ x: 0,
48
55
                                  y: 0,
49
56
                                  style_class: 'lightbox',
52
59
        container.add_actor(this.actor);
53
60
        this.actor.raise_top();
54
61
        this.actor.hide();
 
62
        this.shown = false;
55
63
 
56
64
        this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
57
65
 
93
101
    },
94
102
 
95
103
    show: function() {
96
 
        if (this._fadeTime) {
 
104
        if (this._fadeInTime) {
 
105
            this.shown = false;
97
106
            this.actor.opacity = 0;
98
107
            Tweener.addTween(this.actor,
99
 
                             { opacity: 255,
100
 
                               time: this._fadeTime,
101
 
                               transition: 'easeOutQuad'
 
108
                             { opacity: 255 * this._fadeFactor,
 
109
                               time: this._fadeInTime,
 
110
                               transition: 'easeOutQuad',
 
111
                               onComplete: Lang.bind(this, function() {
 
112
                                   this.shown = true;
 
113
                               })
102
114
                             });
103
115
        } else {
104
 
            this.actor.opacity = 255;
 
116
            this.actor.opacity = 255 * this._fadeFactor;
 
117
            this.shown = true;
105
118
        }
106
119
        this.actor.show();
107
120
    },
108
121
 
109
122
    hide: function() {
110
 
        if (this._fadeTime) {
 
123
        this.shown = false;
 
124
        if (this._fadeOutTime) {
111
125
            Tweener.addTween(this.actor,
112
126
                             { opacity: 0,
113
 
                               time: this._fadeTime,
 
127
                               time: this._fadeOutTime,
114
128
                               transition: 'easeOutQuad',
115
129
                               onComplete: Lang.bind(this, function() {
116
130
                                   this.actor.hide();