[gnome-shell/wip/re-search-v2: 16/28] workspaceThumbnail: Rename show(), hide() and add new methods
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/re-search-v2: 16/28] workspaceThumbnail: Rename show(), hide() and add new methods
- Date: Mon, 3 Dec 2012 18:16:32 +0000 (UTC)
commit 69a1a5518463800d4df55cdecc91f20a3d94b9d5
Author: Tanner Doshier <doshitan gmail com>
Date: Thu Jul 26 12:10:16 2012 -0500
workspaceThumbnail: Rename show(), hide() and add new methods
show() and hide() now slide the thumbnails in and out, respectively. The old
show and hide are now _createThumbnails and _destroyThumbnails. We only care
about these thumbnails while in the overview, so create them when entering and
destroy them on exit.
https://bugzilla.gnome.org/show_bug.cgi?id=682050
js/ui/workspaceThumbnail.js | 42 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js
index 3b9cf03..1a87fe4 100644
--- a/js/ui/workspaceThumbnail.js
+++ b/js/ui/workspaceThumbnail.js
@@ -547,6 +547,11 @@ const ThumbnailsBox = new Lang.Class({
this.actor.connect('scroll-event',
Lang.bind(this, this._onScrollEvent));
+ Main.overview.connect('showing',
+ Lang.bind(this, this._createThumbnails));
+ Main.overview.connect('hidden',
+ Lang.bind(this, this._destroyThumbnails));
+
Main.overview.connect('item-drag-begin',
Lang.bind(this, this._onDragBegin));
Main.overview.connect('item-drag-end',
@@ -734,7 +739,7 @@ const ThumbnailsBox = new Lang.Class({
}
},
- show: function() {
+ _createThumbnails: function() {
this._switchWorkspaceNotifyId =
global.window_manager.connect('switch-workspace',
Lang.bind(this, this._activeWorkspaceChanged));
@@ -763,10 +768,15 @@ const ThumbnailsBox = new Lang.Class({
this.addThumbnails(0, global.screen.n_workspaces);
+ // reset any translation and make sure the actor is visible when
+ // entering the overview
+ this.actor.translation_x = 0;
+ this.actor.show();
+
this._updateSwitcherVisibility();
},
- hide: function() {
+ _destroyThumbnails: function() {
if (this._switchWorkspaceNotifyId > 0) {
global.window_manager.disconnect(this._switchWorkspaceNotifyId);
this._switchWorkspaceNotifyId = 0;
@@ -781,6 +791,34 @@ const ThumbnailsBox = new Lang.Class({
this._thumbnails = [];
},
+ _computeTranslation: function() {
+ let rtl = (this.actor.get_text_direction() == Clutter.TextDirection.RTL);
+
+ if (rtl)
+ return - this.actor.width;
+ else
+ return this.actor.width;
+ },
+
+ show: function() {
+ this.actor.show();
+ Tweener.addTween(this.actor, { translation_x: 0,
+ transition: 'easeOutQuad',
+ time: SLIDE_ANIMATION_TIME
+ });
+ },
+
+ hide: function() {
+ let hiddenX = this._computeTranslation();
+ Tweener.addTween(this.actor, { translation_x: hiddenX,
+ transition: 'easeOutQuad',
+ time: SLIDE_ANIMATION_TIME,
+ onComplete: Lang.bind(this, function () {
+ this.actor.hide();
+ })
+ });
+ },
+
_workspacesChanged: function() {
let oldNumWorkspaces = this._thumbnails.length;
let newNumWorkspaces = global.screen.n_workspaces;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]