495
495
static JSValueRef
496
get_string_property_cb (JSContextRef context,
497
JSObjectRef function,
498
JSObjectRef thisObject,
499
size_t argumentCount,
500
const JSValueRef arguments[],
501
JSValueRef *exception)
503
LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
504
JSStringRef name_arg;
509
// FIXME: Throw exception
510
if (argumentCount != 1)
511
return JSValueMakeNull (context);
513
name_arg = JSValueToStringCopy (context, arguments[0], NULL);
514
JSStringGetUTF8CString (name_arg, name, 1024);
515
JSStringRelease (name_arg);
517
value = ldm_greeter_get_string_property (greeter, name);
520
return JSValueMakeNull (context);
522
string = JSStringCreateWithUTF8CString (value);
524
return JSValueMakeString (context, string);
528
get_integer_property_cb (JSContextRef context,
529
JSObjectRef function,
530
JSObjectRef thisObject,
531
size_t argumentCount,
532
const JSValueRef arguments[],
533
JSValueRef *exception)
535
LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
536
JSStringRef name_arg;
539
// FIXME: Throw exception
540
if (argumentCount != 1)
541
return JSValueMakeNull (context);
543
name_arg = JSValueToStringCopy (context, arguments[0], NULL);
544
JSStringGetUTF8CString (name_arg, name, 1024);
545
JSStringRelease (name_arg);
547
return JSValueMakeNumber (context, ldm_greeter_get_integer_property (greeter, name));
551
get_boolean_property_cb (JSContextRef context,
552
JSObjectRef function,
553
JSObjectRef thisObject,
554
size_t argumentCount,
555
const JSValueRef arguments[],
556
JSValueRef *exception)
558
LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
559
JSStringRef name_arg;
562
// FIXME: Throw exception
563
if (argumentCount != 1)
564
return JSValueMakeNull (context);
566
name_arg = JSValueToStringCopy (context, arguments[0], NULL);
567
JSStringGetUTF8CString (name_arg, name, 1024);
568
JSStringRelease (name_arg);
570
return JSValueMakeBoolean (context, ldm_greeter_get_boolean_property (greeter, name));
496
574
cancel_timed_login_cb (JSContextRef context,
497
575
JSObjectRef function,
498
576
JSObjectRef thisObject,
827
905
static const JSStaticFunction ldm_greeter_functions[] =
829
{ "cancel_timed_login", cancel_timed_login_cb, kJSPropertyAttributeReadOnly },
907
{ "get_string_property", get_string_property_cb, kJSPropertyAttributeReadOnly },
908
{ "get_integer_property", get_integer_property_cb, kJSPropertyAttributeReadOnly },
909
{ "get_boolean_property", get_boolean_property_cb, kJSPropertyAttributeReadOnly },
910
{ "cancel_timed_login", cancel_timed_login_cb, kJSPropertyAttributeReadOnly },
830
911
{ "start_authentication", start_authentication_cb, kJSPropertyAttributeReadOnly },
831
912
{ "provide_secret", provide_secret_cb, kJSPropertyAttributeReadOnly },
832
913
{ "cancel_authentication", cancel_authentication_cb, kJSPropertyAttributeReadOnly },