~darkxst/ubuntu/saucy/gnome-shell/upstart_log

« back to all changes in this revision

Viewing changes to js/ui/status/power.js

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-05-31 12:01:12 UTC
  • mfrom: (1.1.49) (19.1.36 experimental)
  • Revision ID: package-import@ubuntu.com-20130531120112-ew91khxf051x9i2r
Tags: 3.8.2-1ubuntu1
* Merge with Debian (LP: #1185869, #1185721). Remaining changes:
  - debian/control.in:
    + Build-depend on libsystemd-login-dev & libsystemd-daemon-dev
    + Depend on gdm instead of gdm3
    + Don't recommend gnome-session-fallback
  - debian/patches/40_change-pam-name-to-match-gdm.patch:
  - debian/patches/revert-suspend-break.patch:
    + Disabled, not needed on Ubuntu
  - debian/patches/ubuntu-lightdm-user-switching.patch:
    + Allow user switching when using LightDM. Thanks Gerhard Stein
      for rebasing against gnome-shell 3.8!
  - debian/patches/ubuntu_lock_on_suspend.patch
    + Respect Ubuntu's lock-on-suspend setting.
      Disabled until it can be rewritten.
  - debian/patches/git_relock_screen_after_crash.patch:
    + Add Upstream fix for unlocked session after crash (LP: #1064584)
* Note that the new GNOME Classic mode (which requires installing
  gnome-shell-extensions) won't work until gnome-session 3.8 is
  available in Ubuntu

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
const PanelMenu = imports.ui.panelMenu;
8
8
const PopupMenu = imports.ui.popupMenu;
9
9
 
10
 
const BUS_NAME = 'org.gnome.SettingsDaemon';
 
10
const BUS_NAME = 'org.gnome.SettingsDaemon.Power';
11
11
const OBJECT_PATH = '/org/gnome/SettingsDaemon/Power';
12
12
 
13
13
const UPDeviceType = {
54
54
    _init: function() {
55
55
        this.parent('battery-missing-symbolic', _("Battery"));
56
56
 
57
 
        this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH);
 
57
        this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
 
58
                                           Lang.bind(this, function(proxy, error) {
 
59
                                               if (error) {
 
60
                                                   log(error.message);
 
61
                                                   return;
 
62
                                               }
 
63
                                               this._proxy.connect('g-properties-changed',
 
64
                                                                   Lang.bind(this, this._devicesChanged));
 
65
                                               this._devicesChanged();
 
66
                                           }));
58
67
 
59
68
        this._deviceItems = [ ];
60
69
        this._hasPrimary = false;
61
70
        this._primaryDeviceId = null;
62
71
 
63
72
        this._batteryItem = new PopupMenu.PopupMenuItem('', { reactive: false });
64
 
        this._primaryPercentage = new St.Label();
 
73
        this._primaryPercentage = new St.Label({ style_class: 'popup-battery-percentage' });
65
74
        this._batteryItem.addActor(this._primaryPercentage, { align: St.Align.END });
66
75
        this.menu.addMenuItem(this._batteryItem);
67
76
 
70
79
 
71
80
        this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
72
81
        this.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop');
73
 
 
74
 
        this._proxy.connect('g-properties-changed',
75
 
                            Lang.bind(this, this._devicesChanged));
76
 
        this._devicesChanged();
77
82
    },
78
83
 
79
84
    _readPrimaryDevice: function() {
91
96
                if (time == 0) {
92
97
                    // 0 is reported when UPower does not have enough data
93
98
                    // to estimate battery life
94
 
                    this._batteryItem.label.text = _("Estimating...");
 
99
                    this._batteryItem.label.text = _("Estimating…");
95
100
                } else {
96
101
                    let minutes = time % 60;
97
102
                    let hours = Math.floor(time / 60);
183
188
        this._box.add_actor(this._label);
184
189
        this.addActor(this._box);
185
190
 
186
 
        let percentLabel = new St.Label({ text: C_("percent of battery remaining", "%d%%").format(Math.round(percentage)) });
 
191
        let percentLabel = new St.Label({ text: C_("percent of battery remaining", "%d%%").format(Math.round(percentage)),
 
192
                                          style_class: 'popup-battery-percentage' });
187
193
        this.addActor(percentLabel, { align: St.Align.END });
188
194
        //FIXME: ideally we would like to expose this._label and percentLabel
189
195
        this.actor.label_actor = percentLabel;
192
198
    _deviceTypeToString: function(type) {
193
199
        switch (type) {
194
200
        case UPDeviceType.AC_POWER:
195
 
            return _("AC adapter");
 
201
            return _("AC Adapter");
196
202
        case UPDeviceType.BATTERY:
197
 
            return _("Laptop battery");
 
203
            return _("Laptop Battery");
198
204
        case UPDeviceType.UPS:
199
205
            return _("UPS");
200
206
        case UPDeviceType.MONITOR:
206
212
        case UPDeviceType.PDA:
207
213
            return _("PDA");
208
214
        case UPDeviceType.PHONE:
209
 
            return _("Cell phone");
 
215
            return _("Cell Phone");
210
216
        case UPDeviceType.MEDIA_PLAYER:
211
 
            return _("Media player");
 
217
            return _("Media Player");
212
218
        case UPDeviceType.TABLET:
213
219
            return _("Tablet");
214
220
        case UPDeviceType.COMPUTER: