| 220 | } |
| 221 | |
| 222 | static 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 | |
| 247 | static void gjs_object_class_init(void* class_pointer, void*) { |
| 248 | GObjectClass* klass = G_OBJECT_CLASS(class_pointer); |
nothing calls this directly
no test coverage detected