[Xfce4-commits] [xfce/xfce4-power-manager] 01/01: Use translated device type for unknown devices (bug #11217)
noreply at xfce.org
noreply at xfce.org
Thu Oct 30 11:42:52 CET 2014
This is an automated email from the git hooks/post-receive script.
hjudt pushed a commit to branch master
in repository xfce/xfce4-power-manager.
commit ac0335d18eb041a870d573130e3c1858de2dd048
Author: Harald Judt <h.judt at gmx.at>
Date: Tue Oct 28 18:57:38 2014 +0100
Use translated device type for unknown devices (bug #11217)
If the device is unknown to the kernel (maybe no-name stuff or
whatever), then vendor and model will have a hex ID of 31
characters each. We do not want to show them, they are neither
useful nor human-readable, so translate and use the device
type instead of the hex IDs.
This fixes the negative side-effect that the settings window
width is too large.
---
common/xfpm-power-common.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/common/xfpm-power-common.c b/common/xfpm-power-common.c
index 7130497..20f8e2c 100644
--- a/common/xfpm-power-common.c
+++ b/common/xfpm-power-common.c
@@ -349,6 +349,20 @@ get_device_description (UpClient *upower, UpDevice *device)
if (g_strcmp0(vendor, "") == 0 && g_strcmp0(model, "") == 0)
vendor = g_strdup_printf ("%s", xfpm_power_translate_device_type (type));
+ /* If the device is unknown to the kernel (maybe no-name stuff or
+ * whatever), then vendor and model will have a hex ID of 31
+ * characters each. We do not want to show them, they are neither
+ * useful nor human-readable, so translate and use the device
+ * type instead of the hex IDs (see bug #11217).
+ */
+ else if (strlen(vendor) == 31 && strlen(model) == 31)
+ {
+ g_free (vendor);
+ g_free (model);
+ vendor = g_strdup_printf ("%s", xfpm_power_translate_device_type (type));
+ model = g_strdup("");
+ }
+
if ( state == UP_DEVICE_STATE_FULLY_CHARGED )
{
if ( time_to_empty > 0 )
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list