[gnome-shell] Complete porting to new gnome-power-manager API
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] Complete porting to new gnome-power-manager API
- Date: Mon, 22 Nov 2010 17:05:37 +0000 (UTC)
commit 59ba112959ebba8147138a7ad94c542e47f3e420
Author: Giovanni Campagna <gcampagna src gnome org>
Date: Sat Nov 20 18:19:32 2010 +0100
Complete porting to new gnome-power-manager API
We updated the normal devices part, but we forgot the part about
the primary device (possibly because it is not reported as such
in case it is fully charged). Update that as well, to avoid showing
weird GIcon serializations.
https://bugzilla.gnome.org/show_bug.cgi?id=635288
js/ui/status/power.js | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/js/ui/status/power.js b/js/ui/status/power.js
index 52de29e..794a090 100644
--- a/js/ui/status/power.js
+++ b/js/ui/status/power.js
@@ -71,12 +71,19 @@ Indicator.prototype = {
this._deviceItems = [ ];
this._hasPrimary = false;
this._primaryDeviceId = null;
+
this._batteryItem = new PopupMenu.PopupMenuItem('');
+ this._primaryPercentage = new St.Label();
+ let percentBin = new St.Bin();
+ percentBin.set_child(this._primaryPercentage, { x_align: St.Align.END });
+ this._batteryItem.addActor(percentBin);
this.menu.addMenuItem(this._batteryItem);
+
this._deviceSep = new PopupMenu.PopupSeparatorMenuItem();
this.menu.addMenuItem(this._deviceSep);
this._otherDevicePosition = 2;
this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
+
this.menu.addAction(_("What's using power..."),function() {
GLib.spawn_command_line_async('gnome-power-statistics --device wakeups');
});
@@ -98,10 +105,12 @@ Indicator.prototype = {
this._deviceSep.actor.hide();
return;
}
- let [device_id, device_type, summary, percentage, state, time] = device;
+ let [device_id, device_type, icon, percentage, state, time] = device;
if (device_type == UPDeviceType.BATTERY) {
this._hasPrimary = true;
- this._batteryItem.label.text = summary;
+ 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));
this._batteryItem.actor.show();
if (this._deviceItems.length > 0)
this._deviceSep.actor.show();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]