Browse Source

update theme api docs

sisyphus
Dustin Falgout 8 years ago
parent
commit
07fe134488
  1. 2
      web-greeter/bridge/Greeter.py
  2. 18
      web-greeter/resources/js/ThemeUtils.js
  3. 37
      web-greeter/resources/js/docs/Greeter.js
  4. 119
      web-greeter/resources/js/docs/GreeterConfig.js
  5. 20
      web-greeter/resources/js/docs/LightDMObjects.js

2
web-greeter/bridge/Greeter.py

@ -150,7 +150,7 @@ class Greeter(BridgeObject):
return LightDMGreeter.get_has_guest_account_hint()
@bridge.prop(bool)
def hide_users(self):
def hide_users_hint(self):
return LightDMGreeter.get_hide_users_hint()
@bridge.prop(str)

18
web-greeter/resources/js/ThemeUtils.js

@ -38,7 +38,7 @@ function _set_allowed_dirs() {
themes_dir: lightdm.themes_dir,
backgrounds_dir: greeter_config.branding.background_images_dir,
lightdm_data_dir: lightdm.shared_data_dir,
tmpdir: '/tmp',
tmpdir: '/' + 'tmp',
};
}
@ -190,20 +190,4 @@ class ThemeUtils {
return local_time;
}
/**
* Use {@link window.theme_utils.esc_html()} instead.
*
* @deprecated
*/
txt2html( text ) {
try {
return _ThemeUtils.esc_html( text );
} catch( err ) {
console.log( `[ERROR] theme_utils.dirlist(): ${err}` );
return text;
}
}
}

37
web-greeter/resources/js/docs/Greeter.js vendored

@ -123,7 +123,7 @@ class Greeter {
* @type {boolean}
* @readonly
*/
get hide_users() {}
get hide_users_hint() {}
/**
* The system's hostname.
@ -187,13 +187,11 @@ class Greeter {
get lock_hint() {}
/**
* The number of users able to log in.
* @type {number}
* The available remote sessions.
* @type {LightDM.Session[]}
* @readonly
*/
get num_users() {
return this.users.length;
}
get remote_sessions() {}
/**
* Whether or not the guest account should be selected by default.
@ -216,6 +214,24 @@ class Greeter {
*/
get sessions() {}
/**
* Check if a manual login option should be shown. If {@link true}, the theme should
* provide a way for a username to be entered manually. Otherwise, themes that show
* a user list may limit logins to only those users.
* @type {string}
* @readonly
*/
get show_manual_login_hint() {}
/**
* Check if a remote login option should be shown. If {@link true}, the theme should provide
* a way for a user to log into a remote desktop server.
* @type {string}
* @readonly
* @internal
*/
get show_remote_login_hint() {}
/**
* List of available users.
* @type {LightDM.User[]}
@ -246,13 +262,6 @@ class Greeter {
*/
cancel_autologin() {}
/**
* Get the value of a hint.
* @arg {string} name The name of the hint to get.
* @returns {string|boolean|number|null}
*/
get_hint( name ) {}
/**
* Triggers the system to hibernate.
* @returns {boolean} {@link true} if hibernation initiated, otherwise {@link false}
@ -263,7 +272,7 @@ class Greeter {
/**
* Provide a response to a prompt.
* @arg {*} response
* @arg {string} response
*/
respond( response ) {}

119
web-greeter/resources/js/docs/GreeterConfig.js vendored

@ -26,23 +26,6 @@
*/
let _branding = null,
_greeter = null;
function set_values( defaults, target_obj, method ) {
let keys = Object.keys(defaults);
keys.forEach( prop => {
try {
target_obj[prop] = window;
} catch(err) {
target_obj[prop] = defaults[prop];
}
});
}
/**
* Provides greeter themes with a way to access values from the greeter's config
* file located at `/etc/lightdm/web-greeter.conf`. The greeter will
@ -56,29 +39,14 @@ class GreeterConfig {
* Holds keys/values from the `branding` section of the config file.
*
* @type {object} branding
* @prop {string} background_images Path to directory that contains background images
* @prop {string} background_images_dir Path to directory that contains background images
* for use in greeter themes.
* @prop {string} logo Path to distro logo image for use in greeter themes.
* @prop {string} user_image Default user image/avatar. This is used by greeter themes
* for users that have not configured a `.face` image.
* @readonly
*/
get branding() {
if ( null === _branding ) {
let theme_dir = '/usr/share/lightdm-webkit/themes/antergos',
props = {
'background_images': '/usr/share/backgrounds',
'logo': `${theme_dir}/img/antergos-logo-user.png`,
'user_image': `${theme_dir}/img/antergos.png`
};
_branding = {};
set_values( props, _branding, this.get_str );
}
return _branding;
}
get branding() {}
/**
* Holds keys/values from the `greeter` section of the config file.
@ -93,91 +61,12 @@ class GreeterConfig {
* generate localized time for display.
* @prop {string} time_language Language to use when displaying the time or `auto`
* to use the system's language.
* @prop {string} webkit_theme The name of the theme to be used by the greeter.
* @prop {string} theme The name of the theme to be used by the greeter.
* @readonly
*/
get greeter() {
if ( null === _greeter ) {
let bools = {'debug_mode': false, 'secure_mode': true, 'detect_theme_errors': true},
strings = {'time_format': 'LT', 'time_language': 'auto', 'webkit_theme': 'antergos'},
numbers = {'screensaver_timeout': 300};
_greeter = {};
set_values( bools, _greeter, this.get_bool );
set_values( strings, _greeter, this.get_str );
set_values( numbers, _greeter, this.get_num );
}
return _greeter;
}
/**
* ***Deprecated!*** Access config sections directly as properties of this object instead.
*
* @deprecated
*
* @arg {string} config_section
* @arg {string} key
*
* @returns {boolean} Config value for `key`.
*/
get_bool( config_section, key ) {
return __GreeterConfig.get_bool( config_section, key );
get greeter() {}
}
/**
* ***Deprecated!*** Access config sections directly as properties of this object instead.
*
* @deprecated
*
* @arg {string} config_section
* @arg {string} key
*
* @returns {number} Config value for `key`.
*/
get_num( config_section, key ) {
return __GreeterConfig.get_num( config_section, key );
}
/**
* ***Deprecated!*** Access config sections directly as properties of this object instead.
*
* @deprecated
*
* @arg {string} config_section
* @arg {string} key
*
* @returns {string} Config value for `key`.
*/
get_str( config_section, key ) {
return __GreeterConfig.get_str( config_section, key );
}
}
const __greeter_config = new Promise( (resolve, reject) => {
let waiting = 0;
const check_window_prop = () => {
if ( waiting > 15000 ) {
return reject( 'Timeout Reached!');
}
setTimeout( () => {
waiting += 1;
if ( '__GreeterConfig' in window ) {
return resolve( (() => new GreeterConfig())() );
}
check_window_prop();
}, 0 );
};
check_window_prop();
});

20
web-greeter/resources/js/docs/LightDMObjects.js vendored

@ -250,25 +250,5 @@ class User {
get session() {
return this._session;
}
/**
* ***Deprecated!*** See {@link LightDM.User#username}.
* @deprecated
* @type {string}
* @readonly
*/
get name() {
return this._name;
}
/**
* ***Deprecated!*** See {@link LightDM.User#display_name}.
* @deprecated
* @type {string}
* @readonly
*/
get real_name() {
return this._real_name;
}
}

Loading…
Cancel
Save