aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJavier Jardón <javier.jardon@codethink.co.uk>2011-07-14 15:03:26 +0200
committerJavier Jardón <javier.jardon@codethink.co.uk>2011-07-14 15:03:26 +0200
commitcabdda614d6a6c31e4423a992a02e0cd66357464 (patch)
tree5be7b6f4a1007c583a217a3a6afc6940fa01a12d /src
parentf152ea56d9a95fce79420747529245c226ebe99a (diff)
downloadayatana-indicator-power-cabdda614d6a6c31e4423a992a02e0cd66357464.tar.gz
ayatana-indicator-power-cabdda614d6a6c31e4423a992a02e0cd66357464.tar.bz2
ayatana-indicator-power-cabdda614d6a6c31e4423a992a02e0cd66357464.zip
Refine the text of the items in the menu to follow the specification
- "X (H:MM to charge)" if it is charging, with the accessible name "X: MM minutes to charge" or "X: H hours MM minutes to charge" - "X (H:MM left)" if it is discharging with less than 12 hours left,x with the accessible name "X: MM minutes left" or "X: H hours MM minutes left".
Diffstat (limited to 'src')
-rw-r--r--src/indicator-power.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/indicator-power.c b/src/indicator-power.c
index fd3429f..ece0531 100644
--- a/src/indicator-power.c
+++ b/src/indicator-power.c
@@ -262,7 +262,8 @@ build_device_time_details (const gchar *device_name,
UpDeviceState state,
gdouble percentage,
gchar **short_details,
- gchar **details)
+ gchar **details,
+ gchar **accesible_name)
{
gchar *short_timestring = NULL;
gchar *detailed_timestring = NULL;
@@ -279,14 +280,18 @@ build_device_time_details (const gchar *device_name,
if (state == UP_DEVICE_STATE_CHARGING)
{
/* TRANSLATORS: %2 is a time string, e.g. "1 hour 5 minutes" */
- *details = g_strdup_printf (_("%s (%s until charged (%.0lf%%))"),
- device_name, detailed_timestring, percentage);
+ *accesible_name = g_strdup_printf (_("%s (%s to charge (%.0lf%%))"),
+ device_name, detailed_timestring, percentage);
+ *details = g_strdup_printf (_("%s (%s to charge)"),
+ device_name, short_timestring);
}
else if (state == UP_DEVICE_STATE_DISCHARGING)
{
/* TRANSLATORS: %2 is a time string, e.g. "1 hour 5 minutes" */
- *details = g_strdup_printf (_("%s (%s until empty (%.0lf%%))"),
- device_name, detailed_timestring, percentage);
+ *accesible_name = g_strdup_printf (_("%s (%s left (%.0lf%%))"),
+ device_name, detailed_timestring, percentage);
+ *details = g_strdup_printf (_("%s (%s left)"),
+ device_name, short_timestring);
}
}
else
@@ -295,6 +300,7 @@ build_device_time_details (const gchar *device_name,
* used when we don't have a time value */
*details = g_strdup_printf (_("%s (%.0lf%%)"),
device_name, percentage);
+ *accesible_name = g_strdup (*details);
*short_details = g_strdup_printf (_("(%.0lf%%)"),
percentage);
}
@@ -330,6 +336,7 @@ menu_add_device (GtkMenu *menu,
const gchar *device_name;
gchar *short_details = NULL;
gchar *details = NULL;
+ gchar *accesible_name = NULL;
if (device == NULL)
return;
@@ -355,7 +362,7 @@ menu_add_device (GtkMenu *menu,
device_name = device_kind_to_localised_string (kind);
- build_device_time_details (device_name, time, state, percentage, &short_details, &details);
+ build_device_time_details (device_name, time, state, percentage, &short_details, &details, &accesible_name);
/* Create menu item */
item = gtk_image_menu_item_new ();
@@ -519,6 +526,7 @@ put_primary_device (IndicatorPower *self,
GIcon *device_gicons;
gchar *short_details = NULL;
gchar *details = NULL;
+ gchar *accesible_name = NULL;
gchar *device_icon = NULL;
gchar *object_path = NULL;
gdouble percentage;
@@ -549,11 +557,11 @@ put_primary_device (IndicatorPower *self,
device_name = device_kind_to_localised_string (kind);
/* get the description */
- build_device_time_details (device_name, time, state, percentage, &short_details, &details);
+ build_device_time_details (device_name, time, state, percentage, &short_details, &details, &accesible_name);
gtk_label_set_label (GTK_LABEL (priv->label),
short_details);
- set_accessible_desc (self, details);
+ set_accessible_desc (self, accesible_name);
g_free (short_details);
g_free (details);