environment: Be more careful when hooking up style properties

Sometimes it is more appropriate to set layout properties that are
hooked up to CSS properties in code. However this is currently not
possible, as we end up setting properties to 0 when not found in CSS;
be a bit more careful when hooking up CSS properties to support this.

https://bugzilla.gnome.org/show_bug.cgi?id=728897
This commit is contained in:
Florian Müllner 2014-04-24 16:20:01 +02:00
parent 92f9aff784
commit 3969be38bd

View File

@ -47,8 +47,11 @@ function _patchLayoutClass(layoutClass, styleProps) {
layoutClass.prototype.hookup_style = function(container) { layoutClass.prototype.hookup_style = function(container) {
container.connect('style-changed', Lang.bind(this, function() { container.connect('style-changed', Lang.bind(this, function() {
let node = container.get_theme_node(); let node = container.get_theme_node();
for (let prop in styleProps) for (let prop in styleProps) {
this[prop] = node.get_length(styleProps[prop]); let [found, length] = node.lookup_length(styleProps[prop], false);
if (found)
this[prop] = length;
}
})); }));
}; };
layoutClass.prototype.child_set = function(actor, props) { layoutClass.prototype.child_set = function(actor, props) {