From 423ab300951acab4a30f1044900ea7008a079579 Mon Sep 17 00:00:00 2001 From: Scott Balneaves Date: Thu, 14 Jan 2016 20:56:36 -0600 Subject: [PATCH] Couple of additional error checks, remove reference to iconsdir, man page update --- man/lightdm-webkit2-greeter.1 | 18 ++++++++++++++++++ src/lightdm-webkit2-greeter-ext.c | 16 ++++++++++++---- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/man/lightdm-webkit2-greeter.1 b/man/lightdm-webkit2-greeter.1 index d517f66..5d5dff9 100644 --- a/man/lightdm-webkit2-greeter.1 +++ b/man/lightdm-webkit2-greeter.1 @@ -240,6 +240,24 @@ Array\&. The users that are able to log in\&. Returns an Array of LightDMUser objects\&. .RE .PP +The following calls can be made to read configuration keys out of the +lightdm-webkit2-greeter configuration file\&. +.PP +config\&.get_str(section, key)\fR +.RS 4 +Returns the string value associated with key under the "section" in the configuration file\&. +.RE +.PP +config\&.get_num(section, key)\fR +.RS 4 +Returns the numeric value associated with key under the "section" in the configuration file\&. +.RE +.PP +config\&.get_bool(section, key)\fR +.RS 4 +Returns the boolean value associated with key under the "section" in the configuration file\&. +.RE +.PP Please see the LightDM API documentation for the complete list of calls available\&. The lightdm-webkit2-greeter implements all of the LightDM API\&. .PP diff --git a/src/lightdm-webkit2-greeter-ext.c b/src/lightdm-webkit2-greeter-ext.c index cf5b90a..7e03255 100644 --- a/src/lightdm-webkit2-greeter-ext.c +++ b/src/lightdm-webkit2-greeter-ext.c @@ -1039,12 +1039,15 @@ get_conf_str_cb(JSContextRef context, } section = arg_to_string(context, arguments[0], exception); - if (!section) { return JSValueMakeNull(context); } key = arg_to_string(context, arguments[1], exception); + if (!key) { + return JSValueMakeNull(context); + } + value = g_key_file_get_string(keyfile, section, key, &err); if (err) { @@ -1083,12 +1086,15 @@ get_conf_num_cb(JSContextRef context, } section = arg_to_string(context, arguments[0], exception); - if (!section) { return JSValueMakeNull(context); } key = arg_to_string(context, arguments[1], exception); + if (!key) { + return JSValueMakeNull(context); + } + value = g_key_file_get_integer(keyfile, section, key, &err); if (err) { @@ -1123,12 +1129,15 @@ get_conf_bool_cb(JSContextRef context, } section = arg_to_string(context, arguments[0], exception); - if (!section) { return JSValueMakeNull(context); } key = arg_to_string(context, arguments[1], exception); + if (!key) { + return JSValueMakeNull(context); + } + value = g_key_file_get_boolean(keyfile, section, key, &err); if (err) { @@ -1200,7 +1209,6 @@ static const JSStaticValue lightdm_greeter_values[] = { {"autologin_user", get_autologin_user_cb, NULL, kJSPropertyAttributeReadOnly}, {"autologin_guest", get_autologin_guest_cb, NULL, kJSPropertyAttributeReadOnly}, {"autologin_timeout", get_autologin_timeout_cb, NULL, kJSPropertyAttributeReadOnly}, - {"iconsdir", get_iconsdir_cb, NULL, kJSPropertyAttributeReadOnly}, {NULL, NULL, NULL, 0}}; static const JSStaticFunction lightdm_greeter_functions[] = {