[gnome-power-manager] Never return NULL for the object path in GetPrimaryDevice for the composite battery device. Fixes rh



commit fe3a80eca02f7b8ffcc77420c9f841c16c69ba06
Author: Richard Hughes <richard hughsie com>
Date:   Wed Feb 9 09:12:38 2011 +0000

    Never return NULL for the object path in GetPrimaryDevice for the composite battery device. Fixes rh#676055

 src/gpm-manager.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 54e3d1e..89b1e8c 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -2051,6 +2051,7 @@ gpm_manager_device_to_variant_blob (UpDevice *device)
 	GVariant *value;
 	GIcon *icon;
 	gchar *device_icon;
+	const gchar *object_path;
 
 	icon = gpm_upower_get_device_icon (device, FALSE);
 	device_icon = g_icon_to_string (icon);
@@ -2068,9 +2069,14 @@ gpm_manager_device_to_variant_blob (UpDevice *device)
 	else if (state == UP_DEVICE_STATE_CHARGING)
 		time_state = time_full;
 
+	/* get an object path, even for the composite device */
+	object_path = up_device_get_object_path (device);
+	if (object_path == NULL)
+		object_path = "/org/gnome/PowerManager";
+
 	/* format complex object */
 	value = g_variant_new ("(susdut)",
-			       up_device_get_object_path (device),
+			       object_path,
 			       kind,
 			       device_icon,
 			       percentage,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]