~darkxst/ubuntu/quantal/gnome-shell/lp1128804

« back to all changes in this revision

Viewing changes to js/ui/shellMountOperation.js

  • Committer: Package Import Robot
  • Author(s): Tim Lunn
  • Date: 2012-10-09 20:42:33 UTC
  • mfrom: (57.1.7 quantal)
  • Revision ID: package-import@ubuntu.com-20121009204233-chcl8989muuzfpws
Tags: 3.6.0-0ubuntu3
* debian/patches/ubuntu-lightdm-user-switching.patch
  - Fix user switching when running lightdm.  LP: #1064269
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
117
117
                             Lang.bind(this, this._onShowProcesses2));
118
118
        this.mountOp.connect('aborted',
119
119
                             Lang.bind(this, this.close));
 
120
        this.mountOp.connect('show-unmount-progress',
 
121
                             Lang.bind(this, this._onShowUnmountProgress));
120
122
 
121
123
        this._gicon = source.get_icon();
122
124
    },
178
180
            this._dialog.close();
179
181
            this._dialog = null;
180
182
        }
 
183
 
 
184
        if (this._notifier) {
 
185
            this._notifier.done();
 
186
            this._notifier = null;
 
187
        }
181
188
    },
182
189
 
183
190
    _onShowProcesses2: function(op) {
208
215
        this._processesDialog.update(message, processes, choices);
209
216
    },
210
217
 
 
218
    _onShowUnmountProgress: function(op, message, timeLeft, bytesLeft) {
 
219
        if (!this._notifier)
 
220
            this._notifier = new ShellUnmountNotifier();
 
221
            
 
222
        if (bytesLeft == 0)
 
223
            this._notifier.done(message);
 
224
        else
 
225
            this._notifier.show(message);
 
226
    },
 
227
 
211
228
    borrowDialog: function() {
212
229
        if (this._dialogId != 0) {
213
230
            this._dialog.disconnect(this._dialogId);
218
235
    }
219
236
});
220
237
 
 
238
const ShellUnmountNotifier = new Lang.Class({
 
239
    Name: 'ShellUnmountNotifier',
 
240
    Extends: MessageTray.Source,
 
241
 
 
242
    _init: function() {
 
243
        this.parent('', 'media-removable');
 
244
 
 
245
        this._notification = null;
 
246
        Main.messageTray.add(this);
 
247
    },
 
248
 
 
249
    show: function(message) {
 
250
        let [header, text] = message.split('\n', 2);
 
251
 
 
252
        if (!this._notification) {
 
253
            this._notification = new MessageTray.Notification(this, header, text);
 
254
            this._notification.setTransient(true);
 
255
            this._notification.setUrgency(MessageTray.Urgency.CRITICAL);
 
256
        } else {
 
257
            this._notification.update(header, text);
 
258
        }
 
259
 
 
260
        this.notify(this._notification);
 
261
    },
 
262
 
 
263
    done: function(message) {
 
264
        if (this._notification) {
 
265
            this._notification.destroy();
 
266
            this._notification = null;
 
267
        }
 
268
 
 
269
        if (message) {
 
270
            let notification = new MessageTray.Notification(this, message, null);
 
271
            notification.setTransient(true);
 
272
 
 
273
            this.notify(notification);
 
274
        }
 
275
    }
 
276
});
 
277
 
221
278
const ShellMountQuestionDialog = new Lang.Class({
222
279
    Name: 'ShellMountQuestionDialog',
223
280
    Extends: ModalDialog.ModalDialog,
304
361
        if (strings[1])
305
362
            description.set_text(strings[1]);
306
363
 
307
 
        this._passwordBox = new St.BoxLayout({ vertical: false });
 
364
        this._passwordBox = new St.BoxLayout({ vertical: false, style_class: 'prompt-dialog-password-box' });
308
365
        this._messageBox.add(this._passwordBox);
309
366
 
310
367
        this._passwordLabel = new St.Label(({ style_class: 'prompt-dialog-password-label',
311
 
                                              text: _("Passphrase") }));
312
 
        this._passwordBox.add(this._passwordLabel);
 
368
                                              text: _("Password") }));
 
369
        this._passwordBox.add(this._passwordLabel, { y_fill: false, y_align: St.Align.MIDDLE });
313
370
 
314
371
        this._passwordEntry = new St.Entry({ style_class: 'prompt-dialog-password-entry',
315
372
                                             text: "",
329
386
 
330
387
        if (flags & Gio.AskPasswordFlags.SAVING_SUPPORTED) {
331
388
            this._rememberChoice = new CheckBox.CheckBox();
332
 
            this._rememberChoice.getLabelActor().text = _("Remember Passphrase");
 
389
            this._rememberChoice.getLabelActor().text = _("Remember Password");
333
390
            this._rememberChoice.actor.checked = true;
334
391
            this._messageBox.add(this._rememberChoice.actor);
335
392
        } else {
341
398
                         key:    Clutter.Escape
342
399
                       },
343
400
                       { label: _("Unlock"),
344
 
                         action: Lang.bind(this, this._onUnlockButton)
 
401
                         action: Lang.bind(this, this._onUnlockButton),
 
402
                         default: true
345
403
                       }];
346
404
 
347
405
        this.setButtons(buttons);
413
471
        scrollView.hide();
414
472
 
415
473
        this._applicationList = new St.BoxLayout({ vertical: true });
416
 
        scrollView.add_actor(this._applicationList,
417
 
                             { x_fill:  true,
418
 
                               y_fill:  true,
419
 
                               x_align: St.Align.START,
420
 
                               y_align: St.Align.MIDDLE });
 
474
        scrollView.add_actor(this._applicationList);
421
475
 
422
476
        this._applicationList.connect('actor-added',
423
477
                                      Lang.bind(this, function() {