[gnome-shell] PowerStatus: show separate hour and minutes for primary device
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] PowerStatus: show separate hour and minutes for primary device
- Date: Wed, 1 Dec 2010 18:12:30 +0000 (UTC)
commit aef005f451ef7cc0a2f677b9940ffe645e298248
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Fri Nov 26 22:22:07 2010 +0100
PowerStatus: show separate hour and minutes for primary device
Show "%d hours %d minutes" instead of "%d minutes", for better
readability.
https://bugzilla.gnome.org/show_bug.cgi?id=635728
js/ui/status/power.js | 22 ++++++++++++++++++----
po/POTFILES.in | 2 ++
2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/status/power.js b/js/ui/status/power.js
index e8d94be..42face4 100644
--- a/js/ui/status/power.js
+++ b/js/ui/status/power.js
@@ -105,12 +105,26 @@ Indicator.prototype = {
this._deviceSep.actor.hide();
return;
}
- let [device_id, device_type, icon, percentage, state, time] = device;
+ let [device_id, device_type, icon, percentage, state, seconds] = device;
if (device_type == UPDeviceType.BATTERY) {
this._hasPrimary = true;
- let minutes = Math.floor(time / 60);
- this._batteryItem.label.text = Gettext.ngettext("%d minute remaining", "%d minutes remaining", minutes).format(minutes);
- this._primaryPercentage.text = '%d%%'.format(Math.round(percentage));
+ let time = Math.round(seconds / 60);
+ let minutes = time % 60;
+ let hours = Math.floor(time / 60);
+ let timestring;
+ if (time > 60) {
+ if (minutes == 0) {
+ timestring = Gettext.ngettext("%d hour remaining", "%d hours remaining", hours).format(hours);
+ } else {
+ /* TRANSLATORS: this is a time string, as in "%d hours %d minutes remaining" */
+ let template = _("%d %s %d %s remaining");
+
+ timestring = template.format (hours, Gettext.ngettext("hour", "hours", hours), minutes, Gettext.ngettext("minute", "minutes", minutes));
+ }
+ } else
+ timestring = Gettext.ngettext("%d minute remaining", "%d minutes remaining", minutes);
+ this._batteryItem.label.text = timestring;
+ this._primaryPercentage.text = Math.round(percentage) + '%';
this._batteryItem.actor.show();
if (this._deviceItems.length > 0)
this._deviceSep.actor.show();
diff --git a/po/POTFILES.in b/po/POTFILES.in
index fda5f6a..984f6d7 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -15,6 +15,8 @@ js/ui/popupMenu.js
js/ui/runDialog.js
js/ui/statusMenu.js
js/ui/status/accessibility.js
+js/ui/status/power.js
+js/ui/status/volume.js
js/ui/viewSelector.js
js/ui/windowAttentionHandler.js
js/ui/workspacesView.js
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]