magnifier: crosshairs opacity is now a double

The type of the opacity has been changed in
gsettings-desktop-schemas, and a range was added for it.

See also bug 642032

https://bugzilla.gnome.org/show_bug.cgi?id=642175
This commit is contained in:
Bastien Nocera 2011-02-12 15:24:18 +00:00
parent b0efe684fc
commit 4c2d9ca16e

View File

@ -268,7 +268,7 @@ Magnifier.prototype = {
let thickness = this._settings.get_int(CROSS_HAIRS_THICKNESS_KEY); let thickness = this._settings.get_int(CROSS_HAIRS_THICKNESS_KEY);
let color = this._settings.get_string(CROSS_HAIRS_COLOR_KEY); let color = this._settings.get_string(CROSS_HAIRS_COLOR_KEY);
let opacity = this._settings.get_int(CROSS_HAIRS_OPACITY_KEY); let opacity = this._settings.get_double(CROSS_HAIRS_OPACITY_KEY);
let length = this._settings.get_int(CROSS_HAIRS_LENGTH_KEY); let length = this._settings.get_int(CROSS_HAIRS_LENGTH_KEY);
let clip = this._settings.get_boolean(CROSS_HAIRS_CLIP_KEY); let clip = this._settings.get_boolean(CROSS_HAIRS_CLIP_KEY);
@ -354,22 +354,22 @@ Magnifier.prototype = {
/** /**
* setCrosshairsOpacity: * setCrosshairsOpacity:
* @opacity: Value between 0 (transparent) and 255 (fully opaque). * @opacity: Value between 0.0 (transparent) and 1.0 (fully opaque).
*/ */
setCrosshairsOpacity: function(opacity) { setCrosshairsOpacity: function(opacity) {
if (this._crossHairs) if (this._crossHairs)
this._crossHairs.setOpacity(opacity); this._crossHairs.setOpacity(opacity * 255);
}, },
/** /**
* getCrosshairsOpacity: * getCrosshairsOpacity:
* @return: Value between 0 (transparent) and 255 (fully opaque). * @return: Value between 0.0 (transparent) and 1.0 (fully opaque).
*/ */
getCrosshairsOpacity: function() { getCrosshairsOpacity: function() {
if (this._crossHairs) if (this._crossHairs)
return this._crossHairs.getOpacity(); return this._crossHairs.getOpacity() / 255.0;
else else
return 0; return 0.0;
}, },
/** /**
@ -495,7 +495,7 @@ Magnifier.prototype = {
this._settings.connect('changed::' + CROSS_HAIRS_OPACITY_KEY, this._settings.connect('changed::' + CROSS_HAIRS_OPACITY_KEY,
Lang.bind(this, function() { Lang.bind(this, function() {
this.setCrosshairsOpacity(this._settings.get_int(CROSS_HAIRS_OPACITY_KEY)); this.setCrosshairsOpacity(this._settings.get_double(CROSS_HAIRS_OPACITY_KEY));
})); }));
this._settings.connect('changed::' + CROSS_HAIRS_LENGTH_KEY, this._settings.connect('changed::' + CROSS_HAIRS_LENGTH_KEY,