~ubuntu-branches/ubuntu/vivid/gnome-shell-extensions/vivid-proposed

« back to all changes in this revision

Viewing changes to extensions/dock/extension.js

  • Committer: Package Import Robot
  • Author(s): Michael Biebl, Josselin Mouette, Michael Biebl
  • Date: 2012-02-11 23:28:53 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120211232853-mc92yae3sgemtz7l
Tags: 3.2.3-1
[ Josselin Mouette ]
* gnome-shell-extensions.gsettings-override: enable the alternative 
  status menu by default. Closes: #648112.
* Use ${gnome:Version} to generate strict dependencies, it’s very 
  unlikely that extensions remain compatible after a major upgrade.

[ Michael Biebl ]
* Upload to unstable.

[ Josselin Mouette ]
* 01_status-menu_disable_accounts.patch: new patch. Drop the unusable
  advertisement for Google. It is already available in the control 
  center anyway.

[ Michael Biebl ]
* New upstream release.
* Drop patches which have been merged upstream:
  - debian/patches/upstream/*
  - debian/patches/fix-*
* Refresh 01_status-menu_disable_accounts.patch.
* Add 02-Revert-all-remove-all-GSettings-usage.patch: Use GSettings since we
  install the extensions system-wide.
* Use dh-autoreconf to generate the build system.
* Add 03-Revert-Remove-all-references-to-localedir-from-metad.patch: Use
  locales from system-wide location.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
 
46
46
const AutoHideEffect = {
47
47
    RESIZE: 0,
48
 
    RESCALE: 1
 
48
    RESCALE: 1,
 
49
    MOVE: 2
49
50
};
50
51
 
51
52
let position = PositionMode.RIGHT;
250
251
        });
251
252
}
252
253
 
 
254
/**************************************************************************************/
 
255
/**** start move Dock functions                                       *****************/
 
256
/**************************************************************************************/
 
257
function hideDock_move () {
 
258
       this._item_size = dockicon_size;
 
259
       let monitor = Main.layoutManager.primaryMonitor;
 
260
       let cornerX = 0;
 
261
       let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
 
262
       let width = this._item_size + 4*this._spacing;
 
263
 
 
264
       switch (position) {
 
265
            case PositionMode.LEFT:
 
266
                cornerX= monitor.x - width + this._spacing;
 
267
                break;
 
268
            case PositionMode.RIGHT:
 
269
            default:
 
270
                cornerX = monitor.x + monitor.width - this._spacing;
 
271
        }
 
272
 
 
273
        if (hideable) {
 
274
               Tweener.addTween(this.actor,{
 
275
                       x: cornerX,
 
276
                       y: monitor.y + (monitor.height - height)/2,
 
277
                       width: width,
 
278
                       height: height,
 
279
                       time: autohide_animation_time,
 
280
                       transition: 'easeOutQuad'
 
281
                     });
 
282
               hideDock=true;
 
283
        }
 
284
}
 
285
 
 
286
function showDock_move () {
 
287
        this._item_size = dockicon_size;
 
288
        let monitor = Main.layoutManager.primaryMonitor;
 
289
        let position_x = monitor.x;
 
290
        let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
 
291
        let width = this._item_size + 4*this._spacing;
 
292
 
 
293
        switch (position) {
 
294
            case PositionMode.LEFT:
 
295
                position_x=monitor.x - 2*this._spacing;
 
296
                break;
 
297
            case PositionMode.RIGHT:
 
298
            default:
 
299
                 position_x=monitor.x + (monitor.width-this._item_size-2*this._spacing);
 
300
        }
 
301
        Tweener.addTween(this.actor, {
 
302
                x: position_x,
 
303
                y: monitor.y + (monitor.height - height)/2,
 
304
                width: width,
 
305
                height: height,
 
306
                time: autohide_animation_time,
 
307
                transition: 'easeOutQuad'
 
308
        });
 
309
        hideDock=false;
 
310
}
 
311
 
 
312
function initShowDock_move () {
 
313
    this._showDock();
 
314
}
 
315
 
 
316
function showEffectAddItem_move () {
 
317
        let monitor = Main.layoutManager.primaryMonitor;
 
318
        let height = this._nicons*(this._item_size + this._spacing) + 2*this._spacing;
 
319
        let width = this._item_size + 4*this._spacing;
 
320
 
 
321
        Tweener.addTween(this.actor, {
 
322
                y: monitor.y + (monitor.height-height)/2,
 
323
                height: height,
 
324
                width: width,
 
325
                time: autohide_animation_time,
 
326
                transition: 'easeOutQuad'
 
327
        });
 
328
}
 
329
 
253
330
function Dock() {
254
331
    this._init();
255
332
}
343
420
                    return;
344
421
 
345
422
                hideEffect = this._settings.get_enum(DOCK_EFFECTHIDE_KEY);
346
 
                this.actor.y=0;
347
423
 
348
424
                switch (hideEffect) {
349
425
                        case AutoHideEffect.RESCALE:
351
427
                           break;
352
428
                        case AutoHideEffect.RESIZE:
353
429
                           this.actor.set_scale (1,1);
 
430
                           break;
 
431
                        case AutoHideEffect.MOVE:
 
432
                           ;
354
433
                }
355
 
                this.actor.disconnect(leave_event);
356
 
                this.actor.disconnect(enter_event);
 
434
                this.actor.disconnect(this._leave_event);
 
435
                this.actor.disconnect(this._enter_event);
357
436
 
358
437
                this._selectFunctionsHide ();
359
438
 
360
 
                leave_event = this.actor.connect('leave-event', Lang.bind(this, this._hideDock));
361
 
                enter_event = this.actor.connect('enter-event', Lang.bind(this, this._showDock));
 
439
                this._leave_event = this.actor.connect('leave-event', Lang.bind(this, this._hideDock));
 
440
                this._enter_event = this.actor.connect('enter-event', Lang.bind(this, this._showDock));
362
441
                this._redisplay();
363
442
        }));
364
443
 
369
448
                autohide_animation_time = this._settings.get_double(DOCK_AUTOHIDE_ANIMATION_TIME_KEY);
370
449
        }));
371
450
 
372
 
        this.actor.connect('leave-event', Lang.bind(this, this._hideDock));
373
 
        this.actor.connect('enter-event', Lang.bind(this, this._showDock));
 
451
        this._leave_event = this.actor.connect('leave-event', Lang.bind(this, this._hideDock));
 
452
        this._enter_event = this.actor.connect('enter-event', Lang.bind(this, this._showDock));
374
453
 
375
454
        this._hideDock();
376
455
    },
426
505
            this._initShowDock = initShowDock_scale;
427
506
            this._showEffectAddItem = showEffectAddItem_scale;
428
507
            break;
 
508
        case AutoHideEffect.MOVE:
 
509
            this._hideDock = hideDock_move;
 
510
            this._showDock = showDock_move;
 
511
            this._initShowDock = initShowDock_move;
 
512
            this._showEffectAddItem = showEffectAddItem_move;
 
513
            break;
429
514
        case AutoHideEffect.RESIZE:
430
515
        default:
431
516
            this._hideDock = hideDock_size;
850
935
}
851
936
 
852
937
function init(extensionMeta) {
853
 
    imports.gettext.bindtextdomain('gnome-shell-extensions', extensionMeta.localedir);
 
938
    imports.gettext.bindtextdomain('gnome-shell-extensions', GLib.build_filenamev([extensionMeta.path, 'locale']));
854
939
}
855
940
 
856
941
let dock;