diff options
author | Florian Müllner <fmuellner@gnome.org> | 2014-06-08 21:18:49 +0200 |
---|---|---|
committer | Florian Müllner <fmuellner@gnome.org> | 2014-06-08 22:25:27 +0200 |
commit | 589becbc79c7a96144298d75b3abd37f6dc97ccf (patch) | |
tree | 7d7b8782e3adf7a8f2eeb9eafd56a4b97a64d3a6 | |
parent | 4c7fcf272c007defd8b3a358b6022c3ac615858d (diff) |
panelMenu: Clean up code a bit
-rw-r--r-- | js/ui/panelMenu.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/js/ui/panelMenu.js b/js/ui/panelMenu.js index 9bb1f1bc..07494d18 100644 --- a/js/ui/panelMenu.js +++ b/js/ui/panelMenu.js @@ -41,8 +41,7 @@ const ButtonBox = new Lang.Class({ }, _getPreferredWidth: function(actor, forHeight, alloc) { - let children = actor.get_children(); - let child = children.length > 0 ? children[0] : null; + let child = actor.get_first_child(); if (child) { [alloc.min_size, alloc.natural_size] = child.get_preferred_width(-1); @@ -55,8 +54,7 @@ const ButtonBox = new Lang.Class({ }, _getPreferredHeight: function(actor, forWidth, alloc) { - let children = actor.get_children(); - let child = children.length > 0 ? children[0] : null; + let child = actor.get_first_child(); if (child) { [alloc.min_size, alloc.natural_size] = child.get_preferred_height(-1); @@ -66,13 +64,11 @@ const ButtonBox = new Lang.Class({ }, _allocate: function(actor, box, flags) { - let children = actor.get_children(); - if (children.length == 0) + let child = actor.get_first_child(); + if (!child) return; - let child = children[0]; let [minWidth, natWidth] = child.get_preferred_width(-1); - let [minHeight, natHeight] = child.get_preferred_height(-1); let availWidth = box.x2 - box.x1; let availHeight = box.y2 - box.y1; |