From 07fe134488c64efb48961880228f60451150386f Mon Sep 17 00:00:00 2001 From: Dustin Falgout Date: Sun, 12 Feb 2017 22:52:39 -0600 Subject: [PATCH] update theme api docs --- web-greeter/bridge/Greeter.py | 2 +- web-greeter/resources/js/ThemeUtils.js | 18 +-- web-greeter/resources/js/docs/Greeter.js | 37 +++-- .../resources/js/docs/GreeterConfig.js | 127 ++---------------- .../resources/js/docs/LightDMObjects.js | 20 --- 5 files changed, 33 insertions(+), 171 deletions(-) diff --git a/web-greeter/bridge/Greeter.py b/web-greeter/bridge/Greeter.py index 8879f9d..b920543 100644 --- a/web-greeter/bridge/Greeter.py +++ b/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) diff --git a/web-greeter/resources/js/ThemeUtils.js b/web-greeter/resources/js/ThemeUtils.js index 12d039c..f5a7782 100644 --- a/web-greeter/resources/js/ThemeUtils.js +++ b/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; - } - } } diff --git a/web-greeter/resources/js/docs/Greeter.js b/web-greeter/resources/js/docs/Greeter.js index f764188..ced4a7b 100644 --- a/web-greeter/resources/js/docs/Greeter.js +++ b/web-greeter/resources/js/docs/Greeter.js @@ -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 ) {} diff --git a/web-greeter/resources/js/docs/GreeterConfig.js b/web-greeter/resources/js/docs/GreeterConfig.js index a36446f..d18cbdd 100644 --- a/web-greeter/resources/js/docs/GreeterConfig.js +++ b/web-greeter/resources/js/docs/GreeterConfig.js @@ -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 - * 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. + * @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,92 +61,13 @@ 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 ); - } - - /** - * ***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 ); - } + get greeter() {} } -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(); -}); - - diff --git a/web-greeter/resources/js/docs/LightDMObjects.js b/web-greeter/resources/js/docs/LightDMObjects.js index 18315a4..9773250 100644 --- a/web-greeter/resources/js/docs/LightDMObjects.js +++ b/web-greeter/resources/js/docs/LightDMObjects.js @@ -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; - } }