~ubuntu-branches/ubuntu/maverick/gnome-shell/maverick

« back to all changes in this revision

Viewing changes to js/ui/altTab.js

  • Committer: Bazaar Package Importer
  • Author(s): Gustavo Noronha Silva
  • Date: 2009-11-25 19:06:40 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20091125190640-cl36tq1pgy3gkws5
Tags: 2.28.1~git20091125-1
New upstream snapshot

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
const Signals = imports.signals;
12
12
const St = imports.gi.St;
13
13
 
14
 
const AppIcon = imports.ui.appIcon;
15
14
const Main = imports.ui.main;
16
15
const Tweener = imports.ui.tweener;
17
16
 
438
437
    },
439
438
 
440
439
    addItem : function(item) {
441
 
        // We want the St.Bin's padding to be clickable (since it will
442
 
        // be part of the highlighted background color), so we put the
443
 
        // bin inside the ButtonBox rather than vice versa.
444
 
        let bin = new St.Bin({ style_class: 'item-box' });
445
 
        let bbox = new Shell.ButtonBox({ reactive: true });
 
440
        let bbox = new St.Clickable({ style_class: 'item-box',
 
441
                                      reactive: true });
446
442
 
447
 
        bin.add_actor(item);
448
 
        bbox.append(bin, Big.BoxPackFlags.NONE);
 
443
        bbox.set_child(item);
449
444
        this._list.add_actor(bbox);
450
445
 
451
446
        let n = this._items.length;
452
 
        bbox.connect('activate', Lang.bind(this, function () {
 
447
        bbox.connect('clicked', Lang.bind(this, function () {
453
448
                                               this._itemActivated(n);
454
449
                                          }));
455
450
        bbox.connect('enter-event', Lang.bind(this, function () {
456
451
                                                  this._itemEntered(n);
457
452
                                              }));
458
453
 
459
 
        bbox._bin = bin;
460
454
        this._items.push(bbox);
461
455
    },
462
456
 
468
462
    
469
463
    highlight: function(index, justOutline) {
470
464
        if (this._highlighted != -1)
471
 
            this._items[this._highlighted]._bin.style_class = 'item-box';
 
465
            this._items[this._highlighted].style_class = 'item-box';
472
466
 
473
467
        this._highlighted = index;
474
468
 
475
469
        if (this._highlighted != -1) {
476
470
            if (justOutline)
477
 
                this._items[this._highlighted]._bin.style_class = 'outlined-item-box';
 
471
                this._items[this._highlighted].style_class = 'outlined-item-box';
478
472
            else
479
 
                this._items[this._highlighted]._bin.style_class = 'selected-item-box';
 
473
                this._items[this._highlighted].style_class = 'selected-item-box';
480
474
        }
481
475
    },
482
476
 
588
582
 
589
583
Signals.addSignalMethods(SwitcherList.prototype);
590
584
 
 
585
function AppIcon(app) {
 
586
    this._init(app);
 
587
}
 
588
 
 
589
AppIcon.prototype = {
 
590
    _init: function(app) {
 
591
        this.app = app;
 
592
        this.actor = new St.BoxLayout({ style_class: "alt-tab-app",
 
593
                                         vertical: true });
 
594
        this._icon = this.app.create_icon_texture(POPUP_APPICON_SIZE);
 
595
        this.actor.add(this._icon, { x_fill: false, y_fill: false });
 
596
        this._label = new St.Label({ text: this.app.get_name() });
 
597
        this.actor.add(this._label, { x_fill: false });
 
598
    }
 
599
}
 
600
 
591
601
function AppSwitcher(apps) {
592
602
    this._init(apps);
593
603
}
603
613
        let workspaceIcons = [];
604
614
        let otherIcons = [];
605
615
        for (let i = 0; i < apps.length; i++) {
606
 
            let appIcon = new AppIcon.AppIcon({ app: apps[i],
607
 
                                                size: POPUP_APPICON_SIZE });
 
616
            let appIcon = new AppIcon(apps[i]);
608
617
            // Cache the window list now; we don't handle dynamic changes here,
609
618
            // and we don't want to be continually retrieving it
610
619
            appIcon.cachedWindows = appIcon.app.get_windows();
681
690
        this.icons.push(appIcon);
682
691
        this.addItem(appIcon.actor);
683
692
 
684
 
        // SwitcherList creates its own Shell.ButtonBox; we want to
685
 
        // avoid intercepting the events it wants.
686
 
        appIcon.actor.reactive = false;
687
 
 
688
693
        let n = this._arrows.length;
689
 
        let arrow = new Shell.DrawingArea();
 
694
        let arrow = new St.DrawingArea();
690
695
        arrow.connect('redraw', Lang.bind(this,
691
696
            function (area, texture) {
692
697
                Shell.draw_box_pointer(texture, Shell.PointerDirection.DOWN,