aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-05-25 15:31:16 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-05-25 15:31:16 -0500
commitce8268447f48ba8d8bff99d8ac402be7bb9c01d5 (patch)
tree19bc3f6bee713388ea6e148d7ef895c8606c46aa
parent6bbfe3a79da52a5d03224bdb66faf0d41385158d (diff)
downloadayatana-indicator-power-ce8268447f48ba8d8bff99d8ac402be7bb9c01d5.tar.gz
ayatana-indicator-power-ce8268447f48ba8d8bff99d8ac402be7bb9c01d5.tar.bz2
ayatana-indicator-power-ce8268447f48ba8d8bff99d8ac402be7bb9c01d5.zip
indicator_power_set_devices() should fail gracefully when no devices are available
-rw-r--r--src/indicator-power.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index c2ace80..59f884a 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -747,6 +747,9 @@ put_primary_device (IndicatorPower *self, IndicatorPowerDevice *device)
const UpDeviceState state = indicator_power_device_get_state (device);
const gchar * device_icon = indicator_power_device_get_icon (device);
const gdouble percentage = indicator_power_device_get_percentage (device);
+
+g_message ("new primary device: %s", indicator_power_device_get_object_path(device));
+
/* set icon */
device_gicons = get_device_icon (kind, state, time, device_icon);
gtk_image_set_from_gicon (priv->status_image,
@@ -807,9 +810,9 @@ get_devices_cb (GObject * source_object,
gpointer user_data)
{
GError *error;
- int device_count;
- IndicatorPowerDevice ** devices;
+ int device_count = 0;
GVariant * devices_container;
+ IndicatorPowerDevice ** devices = NULL;
IndicatorPower *self = INDICATOR_POWER (user_data);
/* build an array of IndicatorPowerDevices from the DBus response */