[gnome-documents] Revert "Use GtkRevealer for faders instead of Tweener"
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] Revert "Use GtkRevealer for faders instead of Tweener"
- Date: Wed, 24 Apr 2013 22:11:14 +0000 (UTC)
commit 1b852e7640d1a3cc1e0571361dc0c96b4534e850
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Apr 24 18:10:50 2013 -0400
Revert "Use GtkRevealer for faders instead of Tweener"
This reverts commit de8b10a7bb1b9e1c633437588cfe51b79a66cfbe.
src/preview.js | 124 +++++++++++++++++++++++++++-------------------------
src/searchbar.js | 1 +
src/selections.js | 45 +++++++++++--------
3 files changed, 92 insertions(+), 78 deletions(-)
---
diff --git a/src/preview.js b/src/preview.js
index f7110ec..13354c7 100644
--- a/src/preview.js
+++ b/src/preview.js
@@ -32,6 +32,7 @@ const _ = imports.gettext.gettext;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Signals = imports.signals;
+const Tweener = imports.tweener.tweener;
const Application = imports.application;
const MainToolbar = imports.mainToolbar;
@@ -577,21 +578,18 @@ const PreviewNavBar = new Lang.Class({
_init: function(model) {
this._model = model;
-
- this._navbar = new GdPrivate.NavBar({ document_model: model });
- this._navbar.get_style_context().add_class('osd');
-
- this.widget = new Gtk.Revealer({ transition_type: Gtk.RevealerTransitionType.CROSSFADE,
- child: this._navbar,
- valign: Gtk.Align.END,
- margin: _PREVIEW_NAVBAR_MARGIN });
+ this.widget = new GdPrivate.NavBar({ document_model: model,
+ margin: _PREVIEW_NAVBAR_MARGIN,
+ valign: Gtk.Align.END,
+ opacity: 0 });
+ this.widget.get_style_context().add_class('osd');
let button = new Gtk.Button({ action_name: 'app.places',
child: new Gtk.Image({ icon_name: 'view-list-symbolic',
pixel_size: 16 }),
valign: Gtk.Align.CENTER
});
- let buttonArea = this._navbar.get_button_area();
+ let buttonArea = this.widget.get_button_area();
buttonArea.pack_start(button, false, false, 0);
button = new Gtk.ToggleButton({ action_name: 'app.bookmark-page',
@@ -600,13 +598,11 @@ const PreviewNavBar = new Lang.Class({
valign: Gtk.Align.CENTER
});
buttonArea.pack_start(button, false, false, 0);
-
- this.widget.show_all();
},
setModel: function(model) {
this._model = model;
- this._navbar.document_model = model;
+ this.widget.document_model = model;
if (!model)
this.hide();
@@ -619,11 +615,20 @@ const PreviewNavBar = new Lang.Class({
if (!this._model)
return;
- this.widget.reveal_child = true;
+ this.widget.show_all();
+ Tweener.addTween(this.widget, { opacity: 1,
+ time: 0.30,
+ transition: 'easeOutQuad' });
},
hide: function() {
- this.widget.reveal_child = false;
+ Tweener.addTween(this.widget, { opacity: 0,
+ time: 0.30,
+ transition: 'easeOutQuad',
+ onComplete: function() {
+ this.widget.hide();
+ },
+ onCompleteScope: this });
}
});
@@ -635,45 +640,36 @@ const PreviewNavButtons = new Lang.Class({
this._previewView = previewView;
this._model = previewView.getModel();
this._overlay = overlay;
-
this._visible = false;
this._pageChangedId = 0;
this._autoHideId = 0;
this._motionId = 0;
this._hover = false;
- let prevButton = new Gtk.Button({ child: new Gtk.Image ({ icon_name: 'go-previous-symbolic',
- pixel_size: 16 }) });
- prevButton.get_style_context().add_class('osd');
- prevButton.connect('clicked', Lang.bind(this, this._onPrevClicked));
- prevButton.connect('enter-notify-event', Lang.bind(this, this._onEnterNotify));
- prevButton.connect('leave-notify-event', Lang.bind(this, this._onLeaveNotify));
-
- this._prev = new Gtk.Revealer({ transition_type: Gtk.RevealerTransitionType.CROSSFADE,
- margin_left: _PREVIEW_NAVBAR_MARGIN,
- halign: Gtk.Align.START,
- valign: Gtk.Align.CENTER,
- child: prevButton });
- this._overlay.add_overlay(this._prev);
-
- let nextButton = new Gtk.Button({ child: new Gtk.Image ({ icon_name: 'go-next-symbolic',
- pixel_size: 16 }) });
- nextButton.get_style_context().add_class('osd');
- nextButton.connect('clicked', Lang.bind(this, this._onNextClicked));
- nextButton.connect('enter-notify-event', Lang.bind(this, this._onEnterNotify));
- nextButton.connect('leave-notify-event', Lang.bind(this, this._onLeaveNotify));
-
- this._next = new Gtk.Revealer({ transition_type: Gtk.RevealerTransitionType.CROSSFADE,
- margin_right: _PREVIEW_NAVBAR_MARGIN,
- halign: Gtk.Align.END,
- valign: Gtk.Align.CENTER,
- child: nextButton });
- this._overlay.add_overlay(this._next);
-
- this._prev.show_all();
- this._next.show_all();
+ this.prev_widget = new Gtk.Button({ child: new Gtk.Image ({ icon_name: 'go-previous-symbolic',
+ pixel_size: 16 }),
+ margin_left: _PREVIEW_NAVBAR_MARGIN,
+ halign: Gtk.Align.START,
+ valign: Gtk.Align.CENTER });
+ this.prev_widget.get_style_context().add_class('osd');
+ this._overlay.add_overlay(this.prev_widget);
+ this.prev_widget.connect('clicked', Lang.bind(this, this._onPrevClicked));
+ this.prev_widget.connect('enter-notify-event', Lang.bind(this, this._onEnterNotify));
+ this.prev_widget.connect('leave-notify-event', Lang.bind(this, this._onLeaveNotify));
+
+ this.next_widget = new Gtk.Button({ child: new Gtk.Image ({ icon_name: 'go-next-symbolic',
+ pixel_size: 16 }),
+ margin_right: _PREVIEW_NAVBAR_MARGIN,
+ halign: Gtk.Align.END,
+ valign: Gtk.Align.CENTER });
+ this.next_widget.get_style_context().add_class('osd');
+ this._overlay.add_overlay(this.next_widget);
+ this.next_widget.connect('clicked', Lang.bind(this, this._onNextClicked));
+ this.next_widget.connect('enter-notify-event', Lang.bind(this, this._onEnterNotify));
+ this.next_widget.connect('leave-notify-event', Lang.bind(this, this._onLeaveNotify));
this._overlay.connect('motion-notify-event', Lang.bind(this, this._onMotion));
+
},
_onEnterNotify: function() {
@@ -712,8 +708,8 @@ const PreviewNavButtons = new Lang.Class({
},
_autoHide: function() {
- this._fadeOutButton(this._prev);
- this._fadeOutButton(this._next);
+ this._fadeOutButton(this.prev_widget);
+ this._fadeOutButton(this.next_widget);
this._autoHideId = 0;
return false;
},
@@ -733,21 +729,21 @@ const PreviewNavButtons = new Lang.Class({
_updateVisibility: function() {
if (!this._model || !this._visible) {
- this._fadeOutButton(this._prev);
- this._fadeOutButton(this._next);
+ this._fadeOutButton(this.prev_widget);
+ this._fadeOutButton(this.next_widget);
return;
}
if (this._model.page > 0)
- this._fadeInButton(this._prev);
+ this._fadeInButton(this.prev_widget);
else
- this._fadeOutButton(this._prev);
+ this._fadeOutButton(this.prev_widget);
let doc = this._model.document;
if (doc.get_n_pages() > this._model.page + 1)
- this._fadeInButton(this._next);
+ this._fadeInButton(this.next_widget);
else
- this._fadeOutButton(this._next);
+ this._fadeOutButton(this.next_widget);
if (!this._hover)
this._queueAutoHide();
@@ -770,24 +766,32 @@ const PreviewNavButtons = new Lang.Class({
_fadeInButton: function(widget) {
if (!this._model)
return;
-
- widget.reveal_child = true;
+ widget.show_all();
+ Tweener.addTween(widget, { opacity: 1,
+ time: 0.30,
+ transition: 'easeOutQuad' });
},
_fadeOutButton: function(widget) {
- widget.reveal_child = false;
+ Tweener.addTween(widget, { opacity: 0,
+ time: 0.30,
+ transition: 'easeOutQuad',
+ onComplete: function() {
+ widget.hide();
+ },
+ onCompleteScope: this });
},
show: function() {
this._visible = true;
- this._fadeInButton(this._prev);
- this._fadeInButton(this._next);
+ this._fadeInButton(this.prev_widget);
+ this._fadeInButton(this.next_widget);
},
hide: function() {
this._visible = false;
- this._fadeOutButton(this._prev);
- this._fadeOutButton(this._next);
+ this._fadeOutButton(this.prev_widget);
+ this._fadeOutButton(this.next_widget);
}
});
diff --git a/src/searchbar.js b/src/searchbar.js
index 533e0b5..6417e37 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -32,6 +32,7 @@ const Signals = imports.signals;
const Application = imports.application;
const Manager = imports.manager;
+const Tweener = imports.tweener.tweener;
const Utils = imports.utils;
const _SEARCH_ENTRY_TIMEOUT = 200;
diff --git a/src/selections.js b/src/selections.js
index ff811ad..0dc0a5d 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -36,6 +36,7 @@ const Notifications = imports.notifications;
const Properties = imports.properties;
const Query = imports.query;
const Sharing = imports.sharing;
+const Tweener = imports.tweener.tweener;
const Utils = imports.utils;
const Lang = imports.lang;
@@ -724,14 +725,18 @@ const SelectionToolbar = new Lang.Class({
this._itemListeners = {};
this._insideRefresh = false;
- this._toolbar = new Gtk.Toolbar({ show_arrow: false,
- icon_size: Gtk.IconSize.LARGE_TOOLBAR });
- this._toolbar.get_style_context().add_class('osd');
- this._toolbar.set_size_request(_SELECTION_TOOLBAR_DEFAULT_WIDTH, -1);
+ this.widget = new Gtk.Toolbar({ show_arrow: false,
+ halign: Gtk.Align.CENTER,
+ valign: Gtk.Align.END,
+ margin_bottom: 40,
+ icon_size: Gtk.IconSize.LARGE_TOOLBAR,
+ opacity: 0 });
+ this.widget.get_style_context().add_class('osd');
+ this.widget.set_size_request(_SELECTION_TOOLBAR_DEFAULT_WIDTH, -1);
this._leftBox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL });
this._leftGroup = new Gtk.ToolItem({ child: this._leftBox });
- this._toolbar.insert(this._leftGroup, -1);
+ this.widget.insert(this._leftGroup, -1);
// open button
this._toolbarOpen = new Gtk.Button({ child: new Gtk.Image ({ icon_name: 'folder-symbolic',
@@ -756,11 +761,11 @@ const SelectionToolbar = new Lang.Class({
this._separator = new Gtk.SeparatorToolItem({ draw: false,
visible: true });
this._separator.set_expand(true);
- this._toolbar.insert(this._separator, -1);
+ this.widget.insert(this._separator, -1);
this._rightBox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL });
this._rightGroup = new Gtk.ToolItem({ child: this._rightBox });
- this._toolbar.insert(this._rightGroup, -1);
+ this.widget.insert(this._rightGroup, -1);
// organize button
this._toolbarCollection = new Gtk.Button({ child: new Gtk.Image ({ icon_name: 'list-add-symbolic',
@@ -780,16 +785,11 @@ const SelectionToolbar = new Lang.Class({
// share button
this._toolbarShare = new Gtk.Button({ child: new Gtk.Image ({ icon_name: 'emblem-shared-symbolic',
- pixel_size: 16 })});
+ pixel_size: 16 })});
this._toolbarShare.set_tooltip_text(_("Share"));
this._rightBox.add(this._toolbarShare);
this._toolbarShare.connect('clicked', Lang.bind(this, this._onToolbarShare));
- this.widget = new Gtk.Revealer({ transition_type: Gtk.RevealerTransitionType.CROSSFADE,
- halign: Gtk.Align.CENTER,
- valign: Gtk.Align.END,
- margin_bottom: 40,
- child: this._toolbar });
this.widget.show_all();
Application.selectionController.connect('selection-mode-changed',
@@ -821,7 +821,7 @@ const SelectionToolbar = new Lang.Class({
},
_setItemListeners: function(selection) {
- for (let idx in this._itemListeners) {
+ for (idx in this._itemListeners) {
let doc = this._itemListeners[idx];
doc.disconnect(idx);
delete this._itemListeners[idx];
@@ -889,7 +889,7 @@ const SelectionToolbar = new Lang.Class({
},
_onToolbarCollection: function() {
- let toplevel = this._toolbar.get_toplevel();
+ let toplevel = this.widget.get_toplevel();
if (!toplevel.is_toplevel())
return;
@@ -957,14 +957,23 @@ const SelectionToolbar = new Lang.Class({
return;
let doc = Application.documentManager.getItemById(selection[0]);
- doc.print(this._toolbar.get_toplevel());
+ doc.print(this.widget.get_toplevel());
},
_fadeIn: function() {
- this.widget.reveal_child = true;
+ this.widget.show();
+ Tweener.addTween(this.widget, { opacity: 1,
+ time: 0.30,
+ transition: 'easeOutQuad' });
},
_fadeOut: function() {
- this.widget.reveal_child = false;
+ Tweener.addTween(this.widget, { opacity: 0,
+ time: 0.30,
+ transition: 'easeOutQuad',
+ onComplete: function() {
+ this.widget.hide();
+ },
+ onCompleteScope: this });
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]