aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-08-23 08:57:22 -0500
committerCharles Kerr <charles.kerr@canonical.com>2013-08-23 08:57:22 -0500
commitb84432b9493a1b0680a93c9199d6cbbd938e95b4 (patch)
treea7d17b9702c27d1f77bf4b53affd29f99642c025
parentcfda45be70c9d7877d23f3bfdc70672be1fa71f2 (diff)
downloadayatana-indicator-power-b84432b9493a1b0680a93c9199d6cbbd938e95b4.tar.gz
ayatana-indicator-power-b84432b9493a1b0680a93c9199d6cbbd938e95b4.tar.bz2
ayatana-indicator-power-b84432b9493a1b0680a93c9199d6cbbd938e95b4.zip
copyediting: more descriptive comments when building label/header/a11y text
-rw-r--r--src/device.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/device.c b/src/device.c
index 4777675..26b4c04 100644
--- a/src/device.c
+++ b/src/device.c
@@ -449,6 +449,7 @@ indicator_power_device_get_gicon (const IndicatorPowerDevice * device)
****
***/
+/* Format time remaining for reading ("H:MM") and speech ("H hours, MM minutes") */
static void
get_timestring (guint64 time_secs,
gchar **readable_timestring,
@@ -590,12 +591,12 @@ join_strings (const char * name, const char * time, const char * percent)
}
static void
-indicator_power_device_get_time_details (const IndicatorPowerDevice * device,
- gboolean show_time_in_header,
- gboolean show_percentage_in_header,
- gchar ** header,
- gchar ** label,
- gchar ** a11y)
+indicator_power_device_get_text (const IndicatorPowerDevice * device,
+ gboolean show_time_in_header,
+ gboolean show_percentage_in_header,
+ gchar ** header,
+ gchar ** label,
+ gchar ** a11y)
{
if (!INDICATOR_IS_POWER_DEVICE(device))
{
@@ -630,12 +631,16 @@ indicator_power_device_get_time_details (const IndicatorPowerDevice * device,
g_string_printf (verbose_time, _("%s to charge"), readable_timestr);
g_string_printf (accessible_time, _("%s to charge"), accessible_timestr);
}
- else if ((state == UP_DEVICE_STATE_DISCHARGING) && (time < (60*60*12)))
+ else if ((state == UP_DEVICE_STATE_DISCHARGING) && (time <= (60*60*12)))
{
g_string_assign (terse_time, readable_timestr);
g_string_printf (verbose_time, _("%s left"), readable_timestr);
g_string_printf (accessible_time, _("%s left"), accessible_timestr);
}
+ else
+ {
+ /* if there's more than 12 hours remaining, we don't show it */
+ }
g_free (readable_timestr);
g_free (accessible_timestr);
@@ -686,8 +691,8 @@ gchar *
indicator_power_device_get_label (const IndicatorPowerDevice * device)
{
gchar * label = NULL;
- indicator_power_device_get_time_details (device, FALSE, FALSE,
- NULL, &label, NULL);
+ indicator_power_device_get_text (device, FALSE, FALSE,
+ NULL, &label, NULL);
return label;
}
@@ -698,8 +703,8 @@ indicator_power_device_get_header (const IndicatorPowerDevice * device,
gchar ** header,
gchar ** a11y)
{
- indicator_power_device_get_time_details (device, show_time, show_percentage,
- header, NULL, a11y);
+ indicator_power_device_get_text (device, show_time, show_percentage,
+ header, NULL, a11y);
}
/***