Closed marler8997 closed 1 year ago
the Glib "init" hook doesn't provide a way to report an error?
It does have a way: GInitable
.
My assumption is just that it was a shortcut.
All of libportal is going to fail without DBus. So every API needs to handle a no-dbus situation and error. This would be a tedious thing to do.
That said I really don't like the abort()
here. It is bad form for any library.
I guess we don't really need to make every API handle the situation.
Just implement GInitable
, maybe add a new constructor with a GError
and document that applications should use that and handle the failure.
In
xdp_portal_init
, theg_bus_get_sync
can fail if a system has not properly set up DBUS. Instead of aborting, it would be nice if there was a way for the application to detect/handle this error, for example, reporting to the user that DBUS may not have been configured/setup properly.It seems the reason for calling "abort" here could be because the Glib "init" hook doesn't provide a way to report an error? Maybe we'd have to add a function to check for errors on an XdpPortal object after it has been initialized?