コード例 #1
0
ファイル: gjs-require.cpp プロジェクト: groleo/gjs-commonjs
static void
gjs_require_set_property (GObject      *obj,
                          guint         prop_id,
                          const GValue *value,
                          GParamSpec   *pspec)
{
  GjsRequire *self;

  self = GJS_REQUIRE (obj);

  switch (prop_id)
    {

    case PROP_CONTEXT:
      {
        GjsContext *gjs_cx;

        self->priv->context = (JSContext*)g_value_get_pointer (value);

        gjs_cx = (GjsContext*)JS_GetContextPrivate (self->priv->context);
        g_assert (GJS_IS_CONTEXT (gjs_cx));
        g_object_set_data (G_OBJECT (gjs_cx),
                           SELF_DATA_KEY,
                           self);

        create_search_paths (self);
        define_require_function (self);

        gjs_require_push_to_private_paths (self, ".");
        gjs_require_push_to_private_paths (self, JS_LIB_DIR);

        break;
      }

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
      break;
    }
}
コード例 #2
0
ファイル: context.c プロジェクト: RavetcoFX/cjs
/**
 * gjs_context_get_native_context:
 *
 * Returns a pointer to the underlying native context.  For SpiderMonkey, this
 * is a JSContext *
 */
void*
gjs_context_get_native_context (GjsContext *js_context)
{
    g_return_val_if_fail(GJS_IS_CONTEXT(js_context), NULL);
    return js_context->context;
}