mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-08 06:01:22 +00:00
GUAC-634: Allow default value for local properties. Use default values within client and root UI.
This commit is contained in:
@@ -841,7 +841,7 @@ GuacUI.Client.updateDisplayScale = function() {
|
|||||||
|
|
||||||
// If auto-fit is enabled, scale display
|
// If auto-fit is enabled, scale display
|
||||||
if (!GuacUI.Client.overrideAutoFit
|
if (!GuacUI.Client.overrideAutoFit
|
||||||
&& GuacUI.sessionState.getProperty("auto-fit")) {
|
&& GuacUI.sessionState.getProperty("auto-fit", true)) {
|
||||||
|
|
||||||
// Calculate scale to fit screen
|
// Calculate scale to fit screen
|
||||||
var fit_scale = Math.min(
|
var fit_scale = Math.min(
|
||||||
|
@@ -186,7 +186,7 @@ GuacUI.Audio = new (function() {
|
|||||||
this.supported = [];
|
this.supported = [];
|
||||||
|
|
||||||
// If sound disabled, we're done now.
|
// If sound disabled, we're done now.
|
||||||
if (GuacUI.sessionState.getProperty("disable-sound"))
|
if (GuacUI.sessionState.getProperty("disable-sound", false))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Build array of supported audio formats
|
// Build array of supported audio formats
|
||||||
|
@@ -423,25 +423,18 @@ if (GuacamoleRootUI.session_state.getProperty("clipboard"))
|
|||||||
GuacamoleRootUI.fields.clipboard.value =
|
GuacamoleRootUI.fields.clipboard.value =
|
||||||
GuacamoleRootUI.session_state.getProperty("clipboard");
|
GuacamoleRootUI.session_state.getProperty("clipboard");
|
||||||
|
|
||||||
/*
|
|
||||||
* Default to true if auto-fit not specified
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (GuacamoleRootUI.session_state.getProperty("auto-fit") === undefined)
|
|
||||||
GuacamoleRootUI.session_state.setProperty("auto-fit", true);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize auto-fit setting in UI
|
* Initialize auto-fit setting in UI
|
||||||
*/
|
*/
|
||||||
|
|
||||||
GuacamoleRootUI.settings.auto_fit.checked =
|
GuacamoleRootUI.settings.auto_fit.checked =
|
||||||
GuacamoleRootUI.session_state.getProperty("auto-fit");
|
GuacamoleRootUI.session_state.getProperty("auto-fit", true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize disable-sound setting in UI
|
* Initialize disable-sound setting in UI
|
||||||
*/
|
*/
|
||||||
GuacamoleRootUI.settings.disable_sound.checked =
|
GuacamoleRootUI.settings.disable_sound.checked =
|
||||||
GuacamoleRootUI.session_state.getProperty("disable-sound");
|
GuacamoleRootUI.session_state.getProperty("disable-sound", false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set handler for logout
|
* Set handler for logout
|
||||||
|
@@ -72,7 +72,7 @@ function GuacamoleSessionState() {
|
|||||||
* Sets the given property to the given value.
|
* Sets the given property to the given value.
|
||||||
*
|
*
|
||||||
* @param {String} name The name of the property to change.
|
* @param {String} name The name of the property to change.
|
||||||
* @param value An arbitrary value.
|
* @param [value] An arbitrary value.
|
||||||
*/
|
*/
|
||||||
this.setProperty = function(name, value) {
|
this.setProperty = function(name, value) {
|
||||||
state[name] = value;
|
state[name] = value;
|
||||||
@@ -83,10 +83,16 @@ function GuacamoleSessionState() {
|
|||||||
* Returns the value stored under the property having the given name.
|
* Returns the value stored under the property having the given name.
|
||||||
*
|
*
|
||||||
* @param {String} name The name of the property to read.
|
* @param {String} name The name of the property to read.
|
||||||
|
* @param value The default value, if any.
|
||||||
* @return The value of the given property.
|
* @return The value of the given property.
|
||||||
*/
|
*/
|
||||||
this.getProperty = function(name) {
|
this.getProperty = function(name, value) {
|
||||||
return state[name];
|
|
||||||
|
var current = state[name];
|
||||||
|
if (current === undefined)
|
||||||
|
return value;
|
||||||
|
|
||||||
|
return current;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user