[gnome-shell] dash: Construct the label at init



commit 36e5ae4a250e4a647c19ea8938d188d188687fab
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Oct 3 02:19:36 2012 -0300

    dash: Construct the label at init
    
    Nothing doesn't use a label, so it doesn't make sense to
    lazily initialize it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685313

 js/ui/dash.js |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)
---
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 427802a..53894a7 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -48,7 +48,9 @@ const DashItemContainer = new Lang.Class({
                            Lang.bind(this, this._allocate));
         this.actor._delegate = this;
 
-        this.label = null;
+        this.label = new St.Label({ style_class: 'dash-label'});
+        this.label.hide();
+        Main.layoutManager.addChrome(this.label);
 
         this.child = null;
         this._childScale = 1;
@@ -103,9 +105,6 @@ const DashItemContainer = new Lang.Class({
     },
 
     showLabel: function() {
-        if (this.label == null)
-            return;
-
         this.label.opacity = 0;
         this.label.show();
 
@@ -136,19 +135,10 @@ const DashItemContainer = new Lang.Class({
     },
 
     setLabelText: function(text) {
-        if (this.label == null) {
-            this.label = new St.Label({ style_class: 'dash-label'});
-            Main.layoutManager.addChrome(this.label);
-            this.label.hide();
-        }
-
         this.label.set_text(text);
     },
 
     hideLabel: function () {
-        if (this.label == null)
-            return;
-
         Tweener.addTween(this.label,
                          { opacity: 0,
                            time: DASH_ITEM_LABEL_HIDE_TIME,



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