[seed] Implementing the gjs/system refcount method
- From: Alan Knowles <alank src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seed] Implementing the gjs/system refcount method
- Date: Fri, 15 Jan 2016 06:46:45 +0000 (UTC)
commit f5b53fd9fb0c77db32683be5fad88a0ade198109
Author: Danilo Cesar Lemes de Paula <danilo cesar collabora co uk>
Date: Thu Jan 14 13:43:44 2016 -0200
Implementing the gjs/system refcount method
modules/gjs/system/seed-system.c | 32 +++++++++-----------------------
1 files changed, 9 insertions(+), 23 deletions(-)
---
diff --git a/modules/gjs/system/seed-system.c b/modules/gjs/system/seed-system.c
index 6caeb0c..2727019 100644
--- a/modules/gjs/system/seed-system.c
+++ b/modules/gjs/system/seed-system.c
@@ -69,31 +69,17 @@ gjs_refcount (SeedContext ctx,
size_t argumentCount,
const SeedValue arguments[], SeedException * exception)
{
-/*static SeedValue
-gjs_refcount(SeedContext context,
- unsigned argc,
- SeedValue *vp)
-{
- JS::CallArgs argv = JS::CallArgsFromVp (argc, vp);
- SeedValue retval;
- SeedObject *target_obj;
- GObject *obj;
-
- if (!gjs_parse_call_args(context, "refcount", "o", argv, "object", &target_obj))
- return FALSE;
-
- if (!gjs_typecheck_object(context, target_obj,
- G_TYPE_OBJECT, TRUE))
- return FALSE;
+ if (argumentCount != 1) {
+ NUMARG_EXPECTED_EXCEPTION("refcount", "1 argument");
+ }
- obj = gjs_g_object_from_object(context, target_obj);
- if (obj == NULL)
- return FALSE;
+ SeedValue targetValue = arguments[0];
+ GObject *object = seed_value_to_object (ctx, targetValue, exception);
+ if (!object)
+ return seed_make_undefined(ctx);
- retval = INT_TO_JSVAL(obj->ref_count);
- argv.rval().set(retval);
- return TRUE;*/
- return seed_value_from_boolean (ctx, TRUE, exception);
+ SeedValue ret = seed_value_from_uint64(ctx, object->ref_count, exception);
+ return ret;
}
static SeedValue
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]