gplugin/gplugin

Bit of trial and error, mostly errors
feature/gjs-cc
2017-06-06, Gary Kramlich
591c8979078a
Parents c9860ac1e4d1
Children 7a82b93db2f8
Bit of trial and error, mostly errors
--- a/gjs/gplugin-gjs-loader.cc Mon Jun 05 23:30:04 2017 -0500
+++ b/gjs/gplugin-gjs-loader.cc Tue Jun 06 21:11:18 2017 -0500
@@ -174,7 +174,6 @@
context = gjs_context_new();
- g_message("Scope: %p", scope);
if(!_gplugin_gjs_loader_eval_file(context, &scope, filename, error)) {
g_object_unref(G_OBJECT(context));
@@ -185,18 +184,22 @@
jsctx = (JSContext *)gjs_context_get_native_context(context);
/* find the query function */
- query = gplugin_gjs_loader_find_function(jsctx, scope, "gplugin_query",
- error);
+ // query = gplugin_gjs_loader_find_function(jsctx, scope, "gplugin_query",
+ // error);
+
+ // g_message("query: %p", query);
+ // if(query == NULL) {
+ // g_object_unref(G_OBJECT(context));
- g_message("query: %p", query);
- if(query == NULL) {
- g_object_unref(G_OBJECT(context));
+ // return NULL;
+ // }
+
+ // g_message("querying plugin");
- return NULL;
- }
+ JS::AutoValueVector argv(jsctx);
/* now call the query function */
- if(!JS_CallFunction(jsctx, scope, query, 0, NULL, &value)) {
+ if(!JS_CallFunctionName(jsctx, scope, "gplugin_query", 0, argv.begin(), &value)) {
if(error) {
*error = g_error_new(GPLUGIN_DOMAIN, 0,
"Failed to call the query function");