[gnome-shell] calendar: Use AlignConstraint to center the popup
- From: Adel Gadllah <agadllah src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] calendar: Use AlignConstraint to center the popup
- Date: Tue, 4 Jan 2011 16:20:24 +0000 (UTC)
commit dd0f72169451fe4d296908e07ee3389a570c6aa3
Author: Adel Gadllah <adel gadllah gmail com>
Date: Tue Jan 4 17:19:05 2011 +0100
calendar: Use AlignConstraint to center the popup
This fixes warnings like:
(mutter:12238): Clutter-WARNING **: The actor 'calendarPopup' is
currently inside an allocation cycle; calling clutter_actor_queue_relayout()
is not recommended
https://bugzilla.gnome.org/show_bug.cgi?id=637829
js/ui/panel.js | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/panel.js b/js/ui/panel.js
index eb994d1..4439d3d 100644
--- a/js/ui/panel.js
+++ b/js/ui/panel.js
@@ -977,6 +977,9 @@ function CalendarPopup() {
CalendarPopup.prototype = {
_init: function() {
let panelActor = Main.panel.actor;
+ let alignConstraint = new Clutter.AlignConstraint({ source: panelActor,
+ align_axis: Clutter.AlignAxis.X_AXIS,
+ factor: 0.5 });
this.actor = new St.Bin({ name: 'calendarPopup' });
@@ -988,7 +991,7 @@ CalendarPopup.prototype = {
Main.chrome.addActor(this.actor, { visibleInOverview: true,
affectsStruts: false });
this.actor.y = (panelActor.y + panelActor.height - this.actor.height);
- this.calendar.actor.connect('notify::width', Lang.bind(this, this._centerPopup));
+ this.actor.add_constraint(alignConstraint);
},
show: function() {
@@ -1001,7 +1004,6 @@ CalendarPopup.prototype = {
// Reset the calendar to today's date
this.calendar.setDate(new Date());
- this._centerPopup();
this.actor.lower(panelActor);
this.actor.show();
Tweener.addTween(this.actor,
@@ -1025,10 +1027,5 @@ CalendarPopup.prototype = {
onComplete: function() { this.actor.hide(); },
onCompleteScope: this
});
- },
-
- _centerPopup: function() {
- let panelActor = Main.panel.actor;
- this.actor.x = Math.round(panelActor.x + (panelActor.width - this.actor.width) / 2);
}
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]