diff --git a/js/ui/environment.js b/js/ui/environment.js index 707d45f3c0..d8ae645364 100644 --- a/js/ui/environment.js +++ b/js/ui/environment.js @@ -46,6 +46,20 @@ function _patchContainerClass(containerClass) { }; } +function _patchLayoutClass(layoutClass, styleProps) { + if (styleProps) + layoutClass.prototype.hookup_style = function(container) { + container.connect('style-changed', () => { + let node = container.get_theme_node(); + for (let prop in styleProps) { + let [found, length] = node.lookup_length(styleProps[prop], false); + if (found) + this[prop] = length; + } + }); + }; +} + function readOnlyError(property) { global.logError(`The ${property} object is read-only.`); }; @@ -279,6 +293,10 @@ function init() { _patchContainerClass(St.BoxLayout); _patchContainerClass(St.Table); + _patchLayoutClass(Clutter.GridLayout, { row_spacing: 'spacing-rows', + column_spacing: 'spacing-columns' }); + _patchLayoutClass(Clutter.BoxLayout, { spacing: 'spacing' }); + // Cache the original toString since it will be overridden for Clutter.Actor GObject.Object.prototype._toString = GObject.Object.prototype.toString; // Add method to determine if a GObject is finalized - needed to prevent accessing