[gnome-shell/uajain/adapt-user-avatar: 1/6] userWidget: Pack vertically and align in the center



commit 8b83543b7558e0ed2de1a12172045379e9591624
Author: Umang Jain <mailumangjain gmail com>
Date:   Thu Dec 5 20:00:06 2019 +0530

    userWidget: Pack vertically and align in the center

 data/theme/gnome-shell-sass/_common.scss |  6 ++++--
 js/gdm/authPrompt.js                     |  2 +-
 js/ui/userWidget.js                      | 17 +++++++++++------
 3 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/data/theme/gnome-shell-sass/_common.scss b/data/theme/gnome-shell-sass/_common.scss
index 74c04d8ba8..4ccff8c6a5 100644
--- a/data/theme/gnome-shell-sass/_common.scss
+++ b/data/theme/gnome-shell-sass/_common.scss
@@ -1884,6 +1884,7 @@ StScrollBar {
 .user-icon {
   background-size: contain;
   color: $osd_fg_color;
+  text-align: center;
   border-radius: 99px;
   &:hover {
     color: lighten($osd_fg_color,30%);
@@ -2010,10 +2011,11 @@ StScrollBar {
   .login-dialog-username,
   .user-widget-label {
     color: $osd_fg_color;
-    font-size: 120%;
+    font-size: 11pt;
     font-weight: bold;
-    text-align: left;
+    text-align: center;
     padding-left: 15px;
+    padding-top: 24px;
   }
     .user-widget-label {
       &:ltr { padding-left: 14px; }
diff --git a/js/gdm/authPrompt.js b/js/gdm/authPrompt.js
index 6af3427617..0c752caf5a 100644
--- a/js/gdm/authPrompt.js
+++ b/js/gdm/authPrompt.js
@@ -445,7 +445,7 @@ var AuthPrompt = GObject.registerClass({
 
         if (user) {
             let userWidget = new UserWidget.UserWidget(user);
-            userWidget.x_align = Clutter.ActorAlign.START;
+            userWidget.x_align = Clutter.ActorAlign.CENTER;
             this._userWell.set_child(userWidget);
         }
     }
diff --git a/js/ui/userWidget.js b/js/ui/userWidget.js
index 03d4d6388f..3f360e56be 100644
--- a/js/ui/userWidget.js
+++ b/js/ui/userWidget.js
@@ -7,7 +7,7 @@ const { Clutter, GLib, GObject, St } = imports.gi;
 
 const Params = imports.misc.params;
 
-var AVATAR_ICON_SIZE = 64;
+var AVATAR_ICON_SIZE = 128;
 
 // Adapted from gdm/gui/user-switch-applet/applet.c
 //
@@ -20,7 +20,8 @@ class Avatar extends St.Bin {
         let themeContext = St.ThemeContext.get_for_stage(global.stage);
         params = Params.parse(params, { reactive: false,
                                         iconSize: AVATAR_ICON_SIZE,
-                                        styleClass: 'user-icon' });
+                                        styleClass: 'user-icon',
+                                        x_align: St.Align.MIDDLE, });
 
         super._init({
             style_class: params.styleClass,
@@ -73,7 +74,9 @@ class Avatar extends St.Bin {
         } else {
             this.style = null;
             this.child = new St.Icon({ icon_name: 'avatar-default-symbolic',
-                                       icon_size: this._iconSize });
+                                       icon_size: this._iconSize,
+                                       x_expand: true,
+                                       x_align: Clutter.ActorAlign.CENTER });
         }
     }
 });
@@ -86,11 +89,13 @@ class UserWidgetLabel extends St.Widget {
         this._user = user;
 
         this._realNameLabel = new St.Label({ style_class: 'user-widget-label',
-                                             y_align: Clutter.ActorAlign.CENTER });
+                                             x_expand: true,
+                                             x_align: Clutter.ActorAlign.CENTER });
         this.add_child(this._realNameLabel);
 
         this._userNameLabel = new St.Label({ style_class: 'user-widget-label',
-                                             y_align: Clutter.ActorAlign.CENTER });
+                                             x_expand: true,
+                                             x_align: Clutter.ActorAlign.CENTER });
         this.add_child(this._userNameLabel);
 
         this._currentLabel = null;
@@ -160,7 +165,7 @@ class UserWidgetLabel extends St.Widget {
 var UserWidget = GObject.registerClass(
 class UserWidget extends St.BoxLayout {
     _init(user) {
-        super._init({ style_class: 'user-widget', vertical: false });
+        super._init({ style_class: 'user-widget', vertical: true });
 
         this._user = user;
 


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