MCPcopy Create free account
hub / github.com/GNOME/gjs / gjs_object_get_gproperty

Function gjs_object_get_gproperty

gi/gobject.cpp:222–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222static void gjs_object_get_gproperty(GObject* object,
223 unsigned property_id [[maybe_unused]],
224 GValue* value, GParamSpec* pspec) {
225 auto* priv = ObjectInstance::for_gobject(object);
226 if (!priv || !priv->wrapper()) {
227 g_warning("Wrapper for GObject %p was disposed, cannot get property %s",
228 object, g_param_spec_get_name(pspec));
229 return;
230 }
231
232 JSContext* cx = current_js_context();
233
234 JS::RootedObject js_obj(cx, priv->wrapper());
235 JS::RootedValue jsvalue(cx);
236 JSAutoRealm ar(cx, js_obj);
237
238 Gjs::AutoChar underscore_name{gjs_hyphen_to_underscore(pspec->name)};
239 if (!JS_GetProperty(cx, js_obj, underscore_name, &jsvalue)) {
240 gjs_log_exception_uncaught(cx);
241 return;
242 }
243 if (!gjs_value_to_g_value(cx, jsvalue, value))
244 gjs_log_exception(cx);
245}
246
247static void gjs_object_class_init(void* class_pointer, void*) {
248 GObjectClass* klass = G_OBJECT_CLASS(class_pointer);

Callers

nothing calls this directly

Calls 6

current_js_contextFunction · 0.85
gjs_hyphen_to_underscoreFunction · 0.85
gjs_value_to_g_valueFunction · 0.85
gjs_log_exceptionFunction · 0.85
wrapperMethod · 0.80

Tested by

no test coverage detected