[gnome-shell/wip/re-search-v2: 21/28] dash: Add show/hide methods
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/re-search-v2: 21/28] dash: Add show/hide methods
- Date: Mon, 3 Dec 2012 18:11:51 +0000 (UTC)
commit 747b34343bf4cf2a4930668f49b962fd44aa1ea1
Author: Tanner Doshier <doshitan gmail com>
Date: Thu Aug 16 19:59:07 2012 -0500
dash: Add show/hide methods
https://bugzilla.gnome.org/show_bug.cgi?id=682050
js/ui/dash.js | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 48 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 3bd3766..0b81263 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -371,6 +371,7 @@ const Dash = new Lang.Class({
this._maxHeight = -1;
this.iconSize = 64;
this._shownInitially = false;
+ this._ignoreHeight = false;
this._dragPlaceholder = null;
this._dragPlaceholderPos = -1;
@@ -396,7 +397,10 @@ const Dash = new Lang.Class({
this.actor = new St.Bin({ child: this._container });
this.actor.connect('notify::height', Lang.bind(this,
function() {
- if (this._maxHeight != this.actor.height)
+ if (this._ignoreHeight)
+ return;
+
+ if (this._maxHeight != this.actor.height);
this._queueRedisplay();
this._maxHeight = this.actor.height;
}));
@@ -421,6 +425,8 @@ const Dash = new Lang.Class({
Lang.bind(this, this._onDragCancelled));
Main.overview.connect('window-drag-end',
Lang.bind(this, this._onDragEnd));
+ Main.overview.connect('showing',
+ Lang.bind(this, this._onOverviewShowing));
},
_onDragBegin: function() {
@@ -923,6 +929,47 @@ const Dash = new Lang.Class({
}));
return true;
+ },
+
+ _computeTranslation: function() {
+ let rtl = (this.actor.get_text_direction() == Clutter.TextDirection.RTL);
+
+ if (rtl)
+ return this.actor.width;
+ else
+ return - this.actor.width;
+ },
+
+ _onOverviewShowing: function() {
+ // reset any translation and make sure the actor is visible when
+ // entering the overview
+ this.actor.translation_x = 0;
+ this.actor.show();
+ },
+
+ show: function() {
+ this.actor.show();
+ Tweener.addTween(this.actor, { translation_x: 0,
+ transition: 'easeOutQuad',
+ time: DASH_ANIMATION_TIME,
+ onComplete: Lang.bind(this,
+ function() {
+ this._ignoreHeight = false;
+ })
+ });
+ },
+
+ hide: function() {
+ this._ignoreHeight = true;
+ let hiddenX = this._computeTranslation();
+ Tweener.addTween(this.actor, { translation_x: hiddenX,
+ transition: 'easeOutQuad',
+ time: DASH_ANIMATION_TIME,
+ onComplete: Lang.bind(this,
+ function() {
+ this.actor.hide();
+ })
+ });
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]