~lightdm-team/lightdm/1.4

« back to all changes in this revision

Viewing changes to greeters/ldm-webkit-greeter.c

  • Committer: robert.ancell at gmail
  • Date: 2010-07-21 07:30:17 UTC
  • Revision ID: robert.ancell@gmail.com-20100721073017-pom8bmi74o0t1zed
Support theme properties, use this to find the gtkrc in GNOME theme

Show diffs side-by-side

added added

removed removed

Lines of Context:
493
493
}
494
494
 
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)
 
502
{
 
503
    LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
 
504
    JSStringRef name_arg;
 
505
    char name[1024];
 
506
    gchar *value;
 
507
    JSStringRef string;
 
508
 
 
509
    // FIXME: Throw exception
 
510
    if (argumentCount != 1)
 
511
        return JSValueMakeNull (context);
 
512
 
 
513
    name_arg = JSValueToStringCopy (context, arguments[0], NULL);
 
514
    JSStringGetUTF8CString (name_arg, name, 1024);
 
515
    JSStringRelease (name_arg);
 
516
  
 
517
    value = ldm_greeter_get_string_property (greeter, name);
 
518
 
 
519
    if (!value)
 
520
        return JSValueMakeNull (context);
 
521
 
 
522
    string = JSStringCreateWithUTF8CString (value);
 
523
    g_free (value);
 
524
    return JSValueMakeString (context, string);
 
525
}
 
526
 
 
527
static JSValueRef
 
528
get_integer_property_cb (JSContextRef context,
 
529
                         JSObjectRef function,
 
530
                         JSObjectRef thisObject,
 
531
                         size_t argumentCount,
 
532
                         const JSValueRef arguments[],
 
533
                         JSValueRef *exception)
 
534
{
 
535
    LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
 
536
    JSStringRef name_arg;
 
537
    char name[1024];
 
538
 
 
539
    // FIXME: Throw exception
 
540
    if (argumentCount != 1)
 
541
        return JSValueMakeNull (context);
 
542
 
 
543
    name_arg = JSValueToStringCopy (context, arguments[0], NULL);
 
544
    JSStringGetUTF8CString (name_arg, name, 1024);
 
545
    JSStringRelease (name_arg);
 
546
  
 
547
    return JSValueMakeNumber (context, ldm_greeter_get_integer_property (greeter, name));
 
548
}
 
549
 
 
550
static JSValueRef
 
551
get_boolean_property_cb (JSContextRef context,
 
552
                         JSObjectRef function,
 
553
                         JSObjectRef thisObject,
 
554
                         size_t argumentCount,
 
555
                         const JSValueRef arguments[],
 
556
                         JSValueRef *exception)
 
557
{
 
558
    LdmGreeter *greeter = JSObjectGetPrivate (thisObject);
 
559
    JSStringRef name_arg;
 
560
    char name[1024];
 
561
 
 
562
    // FIXME: Throw exception
 
563
    if (argumentCount != 1)
 
564
        return JSValueMakeNull (context);
 
565
 
 
566
    name_arg = JSValueToStringCopy (context, arguments[0], NULL);
 
567
    JSStringGetUTF8CString (name_arg, name, 1024);
 
568
    JSStringRelease (name_arg);
 
569
 
 
570
    return JSValueMakeBoolean (context, ldm_greeter_get_boolean_property (greeter, name));
 
571
}
 
572
 
 
573
static JSValueRef
496
574
cancel_timed_login_cb (JSContextRef context,
497
575
                       JSObjectRef function,
498
576
                       JSObjectRef thisObject,
826
904
 
827
905
static const JSStaticFunction ldm_greeter_functions[] =
828
906
{
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 },