[gnome-shell/wip/fmuellner/notification-redux: 96/128] messageTray: Update expansion
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/fmuellner/notification-redux: 96/128] messageTray: Update expansion
- Date: Tue, 17 Feb 2015 11:27:44 +0000 (UTC)
commit 0e92af23cf24e027561ce09cd0bf80b078b6e92e
Author: Florian Müllner <fmuellner gnome org>
Date: Sun Feb 15 22:58:02 2015 +0100
messageTray: Update expansion
js/ui/messageTray.js | 37 ++++++++++++++++++++++++++++++++-----
1 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js
index 28b7407..15dbb64 100644
--- a/js/ui/messageTray.js
+++ b/js/ui/messageTray.js
@@ -442,12 +442,13 @@ const LabelExpanderLayout = new Lang.Class({
},
vfunc_get_preferred_height: function(container, forWidth) {
- let child = container.get_first_child();
- if (!child)
+ if (container.get_n_children() < 2)
return this.parent(container, forWidth);
- let [lineMin, lineNat] = child.get_preferred_height(-1);
- let [min, nat] = child.get_preferred_height(forWidth);
+ let children = container.get_children();
+
+ let [lineMin, lineNat] = children[0].get_preferred_height(forWidth);
+ let [min, nat] = children[1].get_preferred_height(forWidth);
let [expandedMin, expandedNat] = [Math.min(min, lineMin * this.expandLines),
Math.min(nat, lineNat * this.expandLines)];
return [lineMin + this._expansion * (expandedMin - lineMin),
@@ -727,9 +728,20 @@ const Notification = new Lang.Class({
if (this.bannerBodyText && !this._bannerBodyAdded) {
this._bannerBodyAdded = true;
+ let layout = this._bannerBodyBin.layout_manager;
+
let label = new URLHighlighter(this.bannerBodyText, this.bannerBodyMarkup);
label.actor.x_expand = true;
+ label.actor.y_expand = true;
+ label.actor.x_align = Clutter.ActorAlign.START;
+ label.actor.y_align = Clutter.ActorAlign.START;
+ label.actor.clutter_text.single_line_mode = true;
+ this._bannerBodyBin.add_actor(label.actor);
+
+ label = new URLHighlighter(this.bannerBodyText, this.bannerBodyMarkup);
+ label.actor.x_expand = true;
label.actor.x_align = Clutter.ActorAlign.START;
+ label.actor.opacity = 0;
this._bannerBodyBin.add_actor(label.actor);
}
},
@@ -882,6 +894,18 @@ const Notification = new Lang.Class({
this._closeButton.visible = hovered;
},
+ _onExpansionUpdate: function() {
+ let bin = this._bannerBodyBin;
+ let expansion = Math.min(Math.max(0, bin.layout_manager.expansion), 1);
+ for (let i = 0; i < bin.get_n_children(); i++) {
+ let child = bin.get_child_at_index(i);
+ if (i == 0)
+ child.opacity = (1 - expansion) * 255;
+ else
+ child.opacity = expansion * 255;
+ }
+ },
+
expand: function(animate) {
this.expanded = true;
@@ -893,7 +917,10 @@ const Notification = new Lang.Class({
Tweener.addTween(this._bannerBodyBin.layout_manager,
{ expansion: 1,
time: ANIMATION_TIME,
- transition: 'easeOutBack' });
+ transition: 'easeOutBack',
+ onUpdate: Lang.bind(this,
+ this._onExpansionUpdate)
+ });
else
this._bannerBodyBin.layout_manager.expansion = 1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]