summaryrefslogtreecommitdiff
path: root/modules/cairo.c
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-09-27 19:30:06 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2013-09-27 21:02:41 -0400
commitfcad2b95a8369aad5b81d1d727e80747d8b42b3b (patch)
treecc51c1233150d7b10546b0347a4ab6270f7bb79d /modules/cairo.c
parent910ea15d9da027a994add18cedce81fa3742a66d (diff)
downloadgjs-wip/imports-cleanup.tar.gz
Rework the native module importing schemewip/imports-cleanup
Make modules always supply their own module object when imported, and simply define the properties that we want to on it afterwards. This simplifies the structure of how native modules work and allows us to remove a significant amount of support code for it.
Diffstat (limited to 'modules/cairo.c')
-rw-r--r--modules/cairo.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/cairo.c b/modules/cairo.c
index d72e39c4..05651692 100644
--- a/modules/cairo.c
+++ b/modules/cairo.c
@@ -45,11 +45,14 @@ gjs_cairo_check_status(JSContext *context,
JSBool
gjs_js_define_cairo_stuff(JSContext *context,
- JSObject *module)
+ JSObject **module_out)
{
jsval obj;
+ JSObject *module;
JSObject *surface_proto, *pattern_proto, *gradient_proto;
+ module = JS_NewObject (context, NULL, NULL, NULL);
+
obj = gjs_cairo_context_create_proto(context, module,
"Context", NULL);
if (JSVAL_IS_NULL(obj))
@@ -122,5 +125,7 @@ gjs_js_define_cairo_stuff(JSContext *context,
if (JSVAL_IS_NULL(obj))
return JS_FALSE;
+ *module_out = module;
+
return JS_TRUE;
}