[gnome-shell/wip/reorg: 15/15] loginDialog: handle really long messages better



commit d985477a9d1b1a9ab83a7683be17286b9f478166
Author: Ray Strode <rstrode redhat com>
Date:   Wed Jun 19 14:01:52 2013 -0400

    loginDialog: handle really long messages better
    
    Right now if a long message comes in, the whole dialog grows. This
    commit fixes that by making the label a label of the entire screen,
    instead of a child of the prompt box. To ensure there's still height
    allocated for it, this commit introduces a dummy placeholder actor.

 data/theme/gnome-shell.css |    3 ++-
 js/ui/auth/loginDialog.js  |   18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 13f148e..3b0703e 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -2246,6 +2246,7 @@ StScrollBar StButton#vhandle:active {
 
 .login-dialog-prompt-login-hint-message {
     font-size: 10.5pt;
+    min-width: 480px;
 }
 
 .login-dialog-user-list-view {
@@ -2352,7 +2353,7 @@ StScrollBar StButton#vhandle:active {
 }
 
 .login-dialog-prompt-entry {
-    width: 25em;
+    width: 480px;
 }
 
 .login-dialog-session-list,
diff --git a/js/ui/auth/loginDialog.js b/js/ui/auth/loginDialog.js
index f932977..7107c95 100644
--- a/js/ui/auth/loginDialog.js
+++ b/js/ui/auth/loginDialog.js
@@ -162,7 +162,23 @@ const LoginDialog = new Lang.Class({
                               x_fill: false });
 
         this._promptMessage = new St.Label({ opacity: 0 });
-        this._promptBox.add(this._promptMessage, { x_fill: true });
+        this.actor.add_child(this._promptMessage);
+
+        this._promptMessagePlaceholder = new Clutter.Actor({ width: 1, height: 1 });
+        this._promptBox.add_child(this._promptMessagePlaceholder);
+
+        this._promptMessagePlaceholder.add_constraint(new Clutter.BindConstraint({ source: 
this._promptMessage,
+                                                                                   coordinate: 
Clutter.BindCoordinate.HEIGHT }));
+
+        this._promptMessage.add_constraint(new Clutter.AlignConstraint({ source: this.actor,
+                                                                         align_axis: 
Clutter.AlignAxis.X_AXIS,
+                                                                         factor: 0.5 }));
+
+        this._promptMessagePlaceholder.connect("notify::y", Lang.bind(this, function() {
+                                                   let [placeholderX , placeholderY] = 
this._promptMessagePlaceholder.get_transformed_position();
+                                                   let [actorX, actorY] = 
this.actor.get_transformed_position();
+                                                   this._promptMessage.y = placeholderY - actorY;
+                                               }));
 
         this._sessionList = new SessionList.SessionList();
         this._sessionList.connect('session-activated',


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]