mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-05 20:28:01 +02:00
idevice: Prefer the user-chosen name when available
Use the device name as model name when the user-chosen device name is available. This matches what the Bluez backend does.
This commit is contained in:
parent
38a52894a3
commit
a795750a2e
1 changed files with 10 additions and 0 deletions
|
|
@ -219,6 +219,7 @@ up_device_idevice_refresh (UpDevice *device, UpRefreshReason reason)
|
|||
idevice_t dev = idevice->priv->dev;
|
||||
lockdownd_client_t client = NULL;
|
||||
lockdownd_error_t lerr;
|
||||
char *name = NULL;
|
||||
plist_t dict, node;
|
||||
guint64 percentage;
|
||||
guint8 charging, has_battery;
|
||||
|
|
@ -243,6 +244,15 @@ up_device_idevice_refresh (UpDevice *device, UpRefreshReason reason)
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (lockdownd_get_device_name (client, &name) == LOCKDOWN_E_SUCCESS) {
|
||||
/* Prefer the user-chosen name for the device when available */
|
||||
g_object_set (device,
|
||||
"vendor", NULL,
|
||||
"model", name,
|
||||
NULL);
|
||||
free (name);
|
||||
}
|
||||
|
||||
if (lockdownd_get_value (client, "com.apple.mobile.battery", NULL, &dict) != LOCKDOWN_E_SUCCESS)
|
||||
goto out;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue