[gnome-shell-extensions] apps-menu: Prevent the ApplicationMenuItem from becoming too wide



commit b9fba54b9fb583d38a392185ae12eab0ed226146
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Feb 7 15:59:25 2013 +0100

    apps-menu: Prevent the ApplicationMenuItem from becoming too wide
    
    PopupMenu.PopupBaseMenuItem uses the natural width of its children to
    set its own minimum and natural widths. We don't want that because
    some of our children can be too wide. So, we override it.
    
    We also set the span and expand parameters of the label to -1 and true
    respectively. Otherwise we won't get to see the "...".
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693282

 extensions/apps-menu/extension.js |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/extensions/apps-menu/extension.js b/extensions/apps-menu/extension.js
index e6ab62d..dcecfb1 100644
--- a/extensions/apps-menu/extension.js
+++ b/extensions/apps-menu/extension.js
@@ -57,7 +57,7 @@ const ApplicationMenuItem = new Lang.Class({
 	this.addActor(icon);
 
         let appLabel = new St.Label({ text: app.get_name() });
-        this.addActor(appLabel);
+        this.addActor(appLabel, { span: -1, expand: true });
         this.actor.label_actor = appLabel;
     },
 
@@ -72,6 +72,10 @@ const ApplicationMenuItem = new Lang.Class({
         if (active)
             this._button.scrollToButton(this);
         this.parent(active, params);
+    },
+
+    _getPreferredWidth: function(actor, forHeight, alloc) {
+        alloc.min_size = alloc.natural_size = -1;
     }
 });
 


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