tweener: follow org.gnome.desktop.interface enable-animations

Disable the animations by making the animation time a very small value.

https://bugzilla.gnome.org/show_bug.cgi?id=655746
This commit is contained in:
Cosimo Cecchi 2013-01-26 03:41:46 -05:00
parent 1c57c0e651
commit 5f95351074

View File

@ -1,6 +1,7 @@
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
const Clutter = imports.gi.Clutter; const Clutter = imports.gi.Clutter;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib; const GLib = imports.gi.GLib;
const Lang = imports.lang; const Lang = imports.lang;
const Mainloop = imports.mainloop; const Mainloop = imports.mainloop;
@ -44,9 +45,12 @@ const Tweener = imports.tweener.tweener;
// calls any of these is almost certainly wrong anyway, because they // calls any of these is almost certainly wrong anyway, because they
// affect the entire application.) // affect the entire application.)
let animationSettings = null;
// Called from Main.start // Called from Main.start
function init() { function init() {
Tweener.setFrameTicker(new ClutterFrameTicker()); Tweener.setFrameTicker(new ClutterFrameTicker());
animationSettings = new Gio.Settings({ schema: 'org.gnome.desktop.interface' });
} }
@ -73,6 +77,9 @@ function _wrapTweening(target, tweeningParameters) {
} }
} }
if (!animationSettings.get_boolean('enable-animations'))
tweeningParameters['time'] = 0.000001;
_addHandler(target, tweeningParameters, 'onStart', _tweenStarted); _addHandler(target, tweeningParameters, 'onStart', _tweenStarted);
_addHandler(target, tweeningParameters, 'onComplete', _tweenCompleted); _addHandler(target, tweeningParameters, 'onComplete', _tweenCompleted);
} }