Commit Graph

6 Commits

Author SHA1 Message Date
Richard Hughes
95a5fb2e2f Allow setting the GMainContext when used for sync methods
Use the 'default' main context by default so that we still get the signals
delivered via g_object_notify() but allow the library user to specify an
alternate GMainContext as required.

Using g_main_context_push_thread_default() works for PackageKit as signals are
returned using g_signal_emit() which is synchronous, and so doesn't use the
main context at all.

Use the same style of API which we did for libgusb all those years ago instead.
2020-12-04 07:58:05 +00:00
Richard Hughes
1a14d2be00 Fix sync method when called from threads without a context
Set the thread-default context for the current thread before performing the
async operation.

Hopefully fixes https://github.com/fwupd/fwupd/issues/2600
2020-11-19 16:12:52 +00:00
Richard Hughes
02e7fb527a trivial: Ensure the user called fwupd_client_set_user_agent() as asked 2020-11-18 08:17:28 +00:00
Richard Hughes
56fcdd2776 libfwupd: Add fwupd_client_download_file()
I'm porting gnome-software to use this new API and this would be a very useful
thing to provide. No async API as we want to avoid writing temp files in most
cases -- this is just for legacy apps.
2020-11-18 08:17:28 +00:00
Richard Hughes
7bcb8d4385 Export FwupdPlugin so we can convey enumerated system errors to the end user
For instance, we can tell the user that UEFI UpdateCapsule is disabled in the
system firmware, or that efivarfs is not mounted. This is much better than
creating "dummy" devices which are really just hacks around the problem because
no better API existed. THe dummy devices cause as many problems as they solve.

Plugins have to set FWUPD_PLUGIN_FLAG_USER_WARNING if a warning should be shown
to the user, and only one warning will be shown of each failure type.

It is expected that GUI clients like gnome-software and gnome-firmware would use
this API to notify the user the localized message for why firmware updates are
not being shown.

Fixes https://github.com/fwupd/fwupd/issues/2456
2020-10-13 15:56:49 +01:00
Richard Hughes
7c8a830659 libfwupd: Add async versions of the library for GUI tools
Rather than force the GUI to interact with fwupd using threads, provide
async versions so thay can be run without blocking the UI thread.
2020-09-03 15:46:57 +01:00