aboutsummaryrefslogtreecommitdiff
path: root/src/device.c
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-06-01 13:37:05 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-06-01 13:37:05 -0500
commit9937a075bd77b36f1e8cb7cc9182139b95d66048 (patch)
tree8674ea288731104083c5cb41c61d338c977a472c /src/device.c
parentea0293e260480be4ccb796a51c614966a253fdbe (diff)
downloadayatana-indicator-power-9937a075bd77b36f1e8cb7cc9182139b95d66048.tar.gz
ayatana-indicator-power-9937a075bd77b36f1e8cb7cc9182139b95d66048.tar.bz2
ayatana-indicator-power-9937a075bd77b36f1e8cb7cc9182139b95d66048.zip
in indicator_power_device_get_time_details(), don't list 'not present' for AC Adapters that have no % and no time estimate
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/device.c b/src/device.c
index 75a4139..ae886cc 100644
--- a/src/device.c
+++ b/src/device.c
@@ -518,7 +518,8 @@ indicator_power_device_get_time_details (const IndicatorPowerDevice * device,
const time_t time = indicator_power_device_get_time (device);
const UpDeviceState state = indicator_power_device_get_state (device);
const gdouble percentage = indicator_power_device_get_percentage (device);
- const gchar * device_name = device_kind_to_localised_string (indicator_power_device_get_kind(device));
+ const UpDeviceKind kind = indicator_power_device_get_kind (device);
+ const gchar * device_name = device_kind_to_localised_string (kind);
if (time > 0)
{
@@ -567,6 +568,12 @@ indicator_power_device_get_time_details (const IndicatorPowerDevice * device,
*accessible_name = g_strdup (*details);
*short_details = g_strdup_printf (_("(%.0lf%%)"), percentage);
}
+ else if (kind == UP_DEVICE_KIND_LINE_POWER)
+ {
+ *details = g_strdup (device_name);
+ *accessible_name = g_strdup (device_name);
+ *short_details = g_strdup (device_name);
+ }
else
{
*details = g_strdup_printf (_("%s (not present)"), device_name);