mirror of
https://git.proxmox.com/git/fwupd
synced 2025-07-27 12:54:58 +00:00
Allow front-end clients to read the Percentage property
This commit is contained in:
parent
b3800609b6
commit
1e31507e82
@ -57,6 +57,7 @@ struct _FuDaemon {
|
||||
PolkitAuthority *authority;
|
||||
#endif
|
||||
FwupdStatus status; /* last emitted */
|
||||
guint percentage; /* last emitted */
|
||||
guint owner_id;
|
||||
guint process_quit_id;
|
||||
FuEngine *engine;
|
||||
@ -628,6 +629,11 @@ fu_daemon_modify_config_cb(GObject *source, GAsyncResult *res, gpointer user_dat
|
||||
static void
|
||||
fu_daemon_progress_percentage_changed_cb(FuProgress *progress, guint percentage, FuDaemon *self)
|
||||
{
|
||||
/* sanity check */
|
||||
if (self->percentage == percentage)
|
||||
return;
|
||||
self->percentage = percentage;
|
||||
|
||||
g_debug("Emitting PropertyChanged('Percentage'='%u%%')", percentage);
|
||||
fu_daemon_emit_property_changed(self, "Percentage", g_variant_new_uint32(percentage));
|
||||
}
|
||||
@ -1954,6 +1960,9 @@ fu_daemon_daemon_get_property(GDBusConnection *connection_,
|
||||
if (g_strcmp0(property_name, "Status") == 0)
|
||||
return g_variant_new_uint32(self->status);
|
||||
|
||||
if (g_strcmp0(property_name, "Percentage") == 0)
|
||||
return g_variant_new_uint32(self->percentage);
|
||||
|
||||
if (g_strcmp0(property_name, FWUPD_RESULT_KEY_BATTERY_LEVEL) == 0) {
|
||||
FuContext *ctx = fu_engine_get_context(self->engine);
|
||||
return g_variant_new_uint32(fu_context_get_battery_level(ctx));
|
||||
|
Loading…
Reference in New Issue
Block a user