Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
|
|
|
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
const Gtk = imports.gi.Gtk;
|
|
|
|
const Mainloop = imports.mainloop;
|
2009-08-09 19:48:54 -04:00
|
|
|
const Pango = imports.gi.Pango;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
const Shell = imports.gi.Shell;
|
|
|
|
const Signals = imports.signals;
|
|
|
|
const Lang = imports.lang;
|
2009-10-22 13:33:09 -04:00
|
|
|
const St = imports.gi.St;
|
2009-08-14 09:30:48 -04:00
|
|
|
const Gettext = imports.gettext.domain('gnome-shell');
|
|
|
|
const _ = Gettext.gettext;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
|
|
|
const AppDisplay = imports.ui.appDisplay;
|
2010-02-07 12:59:30 -05:00
|
|
|
const DND = imports.ui.dnd;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
const DocDisplay = imports.ui.docDisplay;
|
2009-10-31 22:25:28 -04:00
|
|
|
const PlaceDisplay = imports.ui.placeDisplay;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
const GenericDisplay = imports.ui.genericDisplay;
|
|
|
|
const Main = imports.ui.main;
|
2010-06-06 14:20:00 -04:00
|
|
|
const Overview = imports.ui.overview;
|
2009-11-29 17:45:30 -05:00
|
|
|
const Search = imports.ui.search;
|
2010-06-06 14:20:00 -04:00
|
|
|
const Tweener = imports.ui.tweener;
|
2009-11-29 17:45:30 -05:00
|
|
|
|
|
|
|
// 25 search results (per result type) should be enough for everyone
|
|
|
|
const MAX_RENDERED_SEARCH_RESULTS = 25;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2009-09-11 16:42:54 -04:00
|
|
|
/*
|
|
|
|
* Returns the index in an array of a given length that is obtained
|
|
|
|
* if the provided index is incremented by an increment and the array
|
|
|
|
* is wrapped in if necessary.
|
2009-11-09 17:49:01 -05:00
|
|
|
*
|
2009-09-11 16:42:54 -04:00
|
|
|
* index: prior index, expects 0 <= index < length
|
|
|
|
* increment: the change in index, expects abs(increment) <= length
|
|
|
|
* length: the length of the array
|
|
|
|
*/
|
|
|
|
function _getIndexWrapped(index, increment, length) {
|
|
|
|
return (index + increment + length) % length;
|
|
|
|
}
|
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
function Pane() {
|
|
|
|
this._init();
|
|
|
|
}
|
|
|
|
|
|
|
|
Pane.prototype = {
|
|
|
|
_init: function () {
|
|
|
|
this._open = false;
|
|
|
|
|
2010-05-13 15:46:04 -04:00
|
|
|
this.actor = new St.BoxLayout({ style_class: 'dash-pane',
|
2009-11-06 14:55:03 -05:00
|
|
|
vertical: true,
|
|
|
|
reactive: true });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this.actor.connect('button-press-event', Lang.bind(this, function (a, e) {
|
|
|
|
// Eat button press events so they don't go through and close the pane
|
|
|
|
return true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
// Hidden by default
|
|
|
|
this.actor.hide();
|
|
|
|
},
|
|
|
|
|
|
|
|
open: function () {
|
|
|
|
if (this._open)
|
|
|
|
return;
|
|
|
|
this._open = true;
|
|
|
|
this.emit('open-state-changed', this._open);
|
2010-06-06 14:20:00 -04:00
|
|
|
this.actor.opacity = 0;
|
|
|
|
this.actor.show();
|
|
|
|
Tweener.addTween(this.actor,
|
|
|
|
{ opacity: 255,
|
|
|
|
time: Overview.PANE_FADE_TIME,
|
|
|
|
transition: 'easeOutQuad'
|
|
|
|
});
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
close: function () {
|
|
|
|
if (!this._open)
|
|
|
|
return;
|
|
|
|
this._open = false;
|
2010-06-06 14:20:00 -04:00
|
|
|
Tweener.addTween(this.actor,
|
|
|
|
{ opacity: 0,
|
|
|
|
time: Overview.PANE_FADE_TIME,
|
|
|
|
transition: 'easeOutQuad',
|
|
|
|
onComplete: Lang.bind(this, function() {
|
|
|
|
this.actor.hide();
|
|
|
|
this.emit('open-state-changed', this._open);
|
|
|
|
})
|
|
|
|
});
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
destroyContent: function() {
|
2010-06-14 13:58:31 -04:00
|
|
|
let children = this.actor.get_children();
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
for (let i = 0; i < children.length; i++) {
|
|
|
|
children[i].destroy();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
toggle: function () {
|
|
|
|
if (this._open)
|
|
|
|
this.close();
|
|
|
|
else
|
|
|
|
this.open();
|
|
|
|
}
|
2010-03-15 09:50:05 -04:00
|
|
|
};
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
Signals.addSignalMethods(Pane.prototype);
|
|
|
|
|
2010-06-14 13:58:31 -04:00
|
|
|
function ResultArea() {
|
|
|
|
this._init();
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
ResultArea.prototype = {
|
2010-06-14 13:58:31 -04:00
|
|
|
_init : function() {
|
2010-03-31 16:40:32 -04:00
|
|
|
this.actor = new St.BoxLayout({ vertical: true });
|
|
|
|
this.resultsContainer = new St.BoxLayout({ style_class: 'dash-results-container' });
|
|
|
|
this.actor.add(this.resultsContainer, { expand: true });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2010-06-14 13:58:31 -04:00
|
|
|
this.display = new DocDisplay.DocDisplay();
|
2010-03-31 16:40:32 -04:00
|
|
|
this.resultsContainer.add(this.display.actor, { expand: true });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this.display.load();
|
|
|
|
}
|
2010-03-15 09:50:05 -04:00
|
|
|
};
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
function ResultPane(dash) {
|
|
|
|
this._init(dash);
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
ResultPane.prototype = {
|
|
|
|
__proto__: Pane.prototype,
|
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
_init: function(dash) {
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
Pane.prototype._init.call(this);
|
|
|
|
|
2010-06-14 13:58:31 -04:00
|
|
|
let resultArea = new ResultArea();
|
|
|
|
this.actor.add(resultArea.actor, { expand: true });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this.connect('open-state-changed', Lang.bind(this, function(pane, isOpen) {
|
|
|
|
resultArea.display.resetState();
|
|
|
|
}));
|
|
|
|
}
|
2010-03-15 09:50:05 -04:00
|
|
|
};
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
|
|
|
function SearchEntry() {
|
|
|
|
this._init();
|
|
|
|
}
|
|
|
|
|
|
|
|
SearchEntry.prototype = {
|
|
|
|
_init : function() {
|
2010-05-13 15:46:04 -04:00
|
|
|
this.actor = new St.Entry({ name: 'searchEntry',
|
2010-02-27 09:49:39 -05:00
|
|
|
hint_text: _("Find") });
|
|
|
|
this.entry = this.actor.clutter_text;
|
|
|
|
|
|
|
|
this.actor.clutter_text.connect('text-changed', Lang.bind(this,
|
|
|
|
function() {
|
|
|
|
if (this.isActive())
|
|
|
|
this.actor.set_secondary_icon_from_file(global.imagedir +
|
2010-05-13 15:46:04 -04:00
|
|
|
'close-black.svg');
|
2010-02-27 09:49:39 -05:00
|
|
|
else
|
|
|
|
this.actor.set_secondary_icon_from_file(null);
|
|
|
|
}));
|
|
|
|
this.actor.connect('secondary-icon-clicked', Lang.bind(this,
|
|
|
|
function() {
|
|
|
|
this.reset();
|
|
|
|
}));
|
|
|
|
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
2009-08-15 16:32:58 -04:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this.pane = null;
|
|
|
|
|
2010-02-27 09:49:39 -05:00
|
|
|
this._capturedEventId = 0;
|
|
|
|
},
|
2009-08-09 19:48:54 -04:00
|
|
|
|
2010-02-27 09:49:39 -05:00
|
|
|
show: function() {
|
|
|
|
if (this._capturedEventId == 0)
|
|
|
|
this._capturedEventId = global.stage.connect('captured-event',
|
|
|
|
Lang.bind(this, this._onCapturedEvent));
|
|
|
|
this.entry.set_cursor_visible(true);
|
|
|
|
this.entry.set_selection(0, 0);
|
|
|
|
},
|
2009-08-15 16:32:58 -04:00
|
|
|
|
2010-02-27 09:49:39 -05:00
|
|
|
hide: function() {
|
|
|
|
if (this.isActive())
|
|
|
|
this.reset();
|
|
|
|
if (this._capturedEventId > 0) {
|
|
|
|
global.stage.disconnect(this._capturedEventId);
|
|
|
|
this._capturedEventId = 0;
|
|
|
|
}
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
},
|
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
reset: function () {
|
2010-05-18 17:56:52 -04:00
|
|
|
let [x, y, mask] = global.get_pointer();
|
|
|
|
let actor = global.stage.get_actor_at_pos (Clutter.PickMode.REACTIVE,
|
|
|
|
x, y);
|
|
|
|
// this.actor is never hovered directly, only its clutter_text and icon
|
|
|
|
let hovered = this.actor == actor.get_parent();
|
|
|
|
|
|
|
|
this.actor.set_hover(hovered);
|
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
this.entry.text = '';
|
2010-02-27 09:49:39 -05:00
|
|
|
global.stage.set_key_focus(null);
|
|
|
|
this.entry.set_cursor_visible(true);
|
|
|
|
this.entry.set_selection(0, 0);
|
2009-08-09 19:48:54 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
getText: function () {
|
2010-02-27 09:49:39 -05:00
|
|
|
return this.entry.get_text().replace(/^\s+/g, '').replace(/\s+$/g, '');
|
|
|
|
},
|
|
|
|
|
|
|
|
// some search term has been entered
|
|
|
|
isActive: function() {
|
|
|
|
return this.actor.get_text() != '';
|
|
|
|
},
|
|
|
|
|
|
|
|
// the entry does not show the hint
|
|
|
|
_isActivated: function() {
|
|
|
|
return this.entry.text == this.actor.get_text();
|
|
|
|
},
|
|
|
|
|
|
|
|
_onCapturedEvent: function(actor, event) {
|
|
|
|
let source = event.get_source();
|
2010-06-10 08:15:02 -04:00
|
|
|
let panelEvent = source && Main.panel.actor.contains(source);
|
2010-02-27 09:49:39 -05:00
|
|
|
|
|
|
|
switch (event.type()) {
|
|
|
|
case Clutter.EventType.BUTTON_PRESS:
|
|
|
|
// the user clicked outside after activating the entry, but
|
|
|
|
// with no search term entered - cancel the search
|
|
|
|
if (source != this.entry && this.entry.text == '') {
|
|
|
|
this.reset();
|
|
|
|
// allow only panel events to continue
|
|
|
|
return !panelEvent;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
case Clutter.EventType.KEY_PRESS:
|
|
|
|
// If neither the stage nor our entry have key focus, some
|
|
|
|
// "special" actor grabbed the focus (run dialog, looking
|
|
|
|
// glass); we don't want to interfere with that
|
|
|
|
let focus = global.stage.get_key_focus();
|
|
|
|
if (focus != global.stage && focus != this.entry)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
let sym = event.get_key_symbol();
|
|
|
|
|
|
|
|
// If we have an active search, Escape cancels it - if we
|
|
|
|
// haven't, the key is ignored
|
|
|
|
if (sym == Clutter.Escape)
|
|
|
|
if (this._isActivated()) {
|
|
|
|
this.reset();
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ignore non-printable keys
|
|
|
|
if (!Clutter.keysym_to_unicode(sym))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// Search started - move the key focus to the entry and
|
|
|
|
// "repeat" the event
|
|
|
|
if (!this._isActivated()) {
|
|
|
|
global.stage.set_key_focus(this.entry);
|
|
|
|
this.entry.event(event, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
default:
|
|
|
|
// Suppress all other events outside the panel while the entry
|
|
|
|
// is activated and no search has been entered - any click
|
|
|
|
// outside the entry will cancel the search
|
|
|
|
return (this.entry.text == '' && !panelEvent);
|
2009-08-09 19:48:54 -04:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2010-02-27 09:49:39 -05:00
|
|
|
_onDestroy: function() {
|
|
|
|
if (this._capturedEventId > 0) {
|
|
|
|
global.stage.disconnect(this._capturedEventId);
|
|
|
|
this._capturedEventId = 0;
|
|
|
|
}
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
Signals.addSignalMethods(SearchEntry.prototype);
|
|
|
|
|
2009-11-29 17:45:30 -05:00
|
|
|
function SearchResult(provider, metaInfo, terms) {
|
|
|
|
this._init(provider, metaInfo, terms);
|
|
|
|
}
|
|
|
|
|
|
|
|
SearchResult.prototype = {
|
|
|
|
_init: function(provider, metaInfo, terms) {
|
|
|
|
this.provider = provider;
|
|
|
|
this.metaInfo = metaInfo;
|
|
|
|
this.actor = new St.Clickable({ style_class: 'dash-search-result',
|
|
|
|
reactive: true,
|
|
|
|
x_align: St.Align.START,
|
|
|
|
x_fill: true,
|
|
|
|
y_fill: true });
|
|
|
|
this.actor._delegate = this;
|
|
|
|
|
|
|
|
let content = provider.createResultActor(metaInfo, terms);
|
|
|
|
if (content == null) {
|
|
|
|
content = new St.BoxLayout({ style_class: 'dash-search-result-content' });
|
|
|
|
let title = new St.Label({ text: this.metaInfo['name'] });
|
|
|
|
let icon = this.metaInfo['icon'];
|
|
|
|
content.add(icon, { y_fill: false });
|
|
|
|
content.add(title, { expand: true, y_fill: false });
|
|
|
|
}
|
|
|
|
this._content = content;
|
|
|
|
this.actor.set_child(content);
|
|
|
|
|
|
|
|
this.actor.connect('clicked', Lang.bind(this, this._onResultClicked));
|
2010-02-07 12:59:30 -05:00
|
|
|
|
|
|
|
let draggable = DND.makeDraggable(this.actor);
|
2010-05-08 10:06:28 -04:00
|
|
|
draggable.connect('drag-begin',
|
|
|
|
Lang.bind(this, function() {
|
|
|
|
Main.overview.beginItemDrag(this);
|
|
|
|
}));
|
|
|
|
draggable.connect('drag-end',
|
|
|
|
Lang.bind(this, function() {
|
|
|
|
Main.overview.endItemDrag(this);
|
|
|
|
}));
|
2009-11-29 17:45:30 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
setSelected: function(selected) {
|
2010-03-19 11:37:04 -04:00
|
|
|
if (selected)
|
|
|
|
this._content.add_style_pseudo_class('selected');
|
|
|
|
else
|
|
|
|
this._content.remove_style_pseudo_class('selected');
|
2009-11-29 17:45:30 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
activate: function() {
|
|
|
|
this.provider.activateResult(this.metaInfo.id);
|
|
|
|
Main.overview.toggle();
|
|
|
|
},
|
|
|
|
|
|
|
|
_onResultClicked: function(actor, event) {
|
|
|
|
this.activate();
|
2010-02-07 12:59:30 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
getDragActorSource: function() {
|
|
|
|
return this.metaInfo['icon'];
|
|
|
|
},
|
|
|
|
|
|
|
|
getDragActor: function(stageX, stageY) {
|
|
|
|
return new Clutter.Clone({ source: this.metaInfo['icon'] });
|
|
|
|
},
|
|
|
|
|
|
|
|
shellWorkspaceLaunch: function() {
|
2010-02-15 17:11:09 -05:00
|
|
|
if (this.provider.dragActivateResult)
|
|
|
|
this.provider.dragActivateResult(this.metaInfo.id);
|
|
|
|
else
|
|
|
|
this.provider.activateResult(this.metaInfo.id);
|
2009-11-29 17:45:30 -05:00
|
|
|
}
|
2010-03-15 09:50:05 -04:00
|
|
|
};
|
2009-11-29 17:45:30 -05:00
|
|
|
|
|
|
|
function OverflowSearchResults(provider) {
|
|
|
|
this._init(provider);
|
|
|
|
}
|
|
|
|
|
|
|
|
OverflowSearchResults.prototype = {
|
|
|
|
__proto__: Search.SearchResultDisplay.prototype,
|
|
|
|
|
|
|
|
_init: function(provider) {
|
|
|
|
Search.SearchResultDisplay.prototype._init.call(this, provider);
|
|
|
|
this.actor = new St.OverflowBox({ style_class: 'dash-search-section-list-results' });
|
|
|
|
},
|
|
|
|
|
2010-02-22 11:39:10 -05:00
|
|
|
getVisibleResultCount: function() {
|
|
|
|
return this.actor.get_n_visible();
|
|
|
|
},
|
|
|
|
|
2009-11-29 17:45:30 -05:00
|
|
|
renderResults: function(results, terms) {
|
|
|
|
for (let i = 0; i < results.length && i < MAX_RENDERED_SEARCH_RESULTS; i++) {
|
|
|
|
let result = results[i];
|
|
|
|
let meta = this.provider.getResultMeta(result);
|
|
|
|
let display = new SearchResult(this.provider, meta, terms);
|
|
|
|
this.actor.add_actor(display.actor);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
selectIndex: function(index) {
|
|
|
|
let nVisible = this.actor.get_n_visible();
|
|
|
|
let children = this.actor.get_children();
|
|
|
|
if (this.selectionIndex >= 0) {
|
|
|
|
let prevActor = children[this.selectionIndex];
|
|
|
|
prevActor._delegate.setSelected(false);
|
|
|
|
}
|
|
|
|
this.selectionIndex = -1;
|
|
|
|
if (index >= nVisible)
|
|
|
|
return false;
|
|
|
|
else if (index < 0)
|
|
|
|
return false;
|
|
|
|
let targetActor = children[index];
|
|
|
|
targetActor._delegate.setSelected(true);
|
|
|
|
this.selectionIndex = index;
|
|
|
|
return true;
|
2010-03-04 15:08:24 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
activateSelected: function() {
|
|
|
|
let children = this.actor.get_children();
|
|
|
|
let targetActor = children[this.selectionIndex];
|
|
|
|
targetActor._delegate.activate();
|
2009-11-29 17:45:30 -05:00
|
|
|
}
|
2010-03-15 09:50:05 -04:00
|
|
|
};
|
2009-11-29 17:45:30 -05:00
|
|
|
|
|
|
|
function SearchResults(searchSystem) {
|
|
|
|
this._init(searchSystem);
|
|
|
|
}
|
|
|
|
|
|
|
|
SearchResults.prototype = {
|
|
|
|
_init: function(searchSystem) {
|
|
|
|
this._searchSystem = searchSystem;
|
|
|
|
|
|
|
|
this.actor = new St.BoxLayout({ name: 'dashSearchResults',
|
|
|
|
vertical: true });
|
2010-01-06 15:00:49 -05:00
|
|
|
this._statusText = new St.Label({ style_class: 'dash-search-statustext' });
|
|
|
|
this.actor.add(this._statusText);
|
2009-11-29 17:45:30 -05:00
|
|
|
this._selectedProvider = -1;
|
|
|
|
this._providers = this._searchSystem.getProviders();
|
|
|
|
this._providerMeta = [];
|
|
|
|
for (let i = 0; i < this._providers.length; i++) {
|
|
|
|
let provider = this._providers[i];
|
|
|
|
let providerBox = new St.BoxLayout({ style_class: 'dash-search-section',
|
|
|
|
vertical: true });
|
|
|
|
let titleButton = new St.Button({ style_class: 'dash-search-section-header',
|
|
|
|
reactive: true,
|
|
|
|
x_fill: true,
|
|
|
|
y_fill: true });
|
|
|
|
titleButton.connect('clicked', Lang.bind(this, function () { this._onHeaderClicked(provider); }));
|
|
|
|
providerBox.add(titleButton);
|
|
|
|
let titleBox = new St.BoxLayout();
|
|
|
|
titleButton.set_child(titleBox);
|
|
|
|
let title = new St.Label({ text: provider.title });
|
|
|
|
let count = new St.Label();
|
|
|
|
titleBox.add(title, { expand: true });
|
|
|
|
titleBox.add(count);
|
|
|
|
|
|
|
|
let resultDisplayBin = new St.Bin({ style_class: 'dash-search-section-results',
|
|
|
|
x_fill: true,
|
|
|
|
y_fill: true });
|
|
|
|
providerBox.add(resultDisplayBin, { expand: true });
|
|
|
|
let resultDisplay = provider.createResultContainerActor();
|
|
|
|
if (resultDisplay == null) {
|
|
|
|
resultDisplay = new OverflowSearchResults(provider);
|
|
|
|
}
|
|
|
|
resultDisplayBin.set_child(resultDisplay.actor);
|
|
|
|
|
|
|
|
this._providerMeta.push({ actor: providerBox,
|
|
|
|
resultDisplay: resultDisplay,
|
|
|
|
count: count });
|
|
|
|
this.actor.add(providerBox);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
_clearDisplay: function() {
|
|
|
|
this._selectedProvider = -1;
|
|
|
|
this._visibleResultsCount = 0;
|
|
|
|
for (let i = 0; i < this._providerMeta.length; i++) {
|
|
|
|
let meta = this._providerMeta[i];
|
|
|
|
meta.resultDisplay.clear();
|
|
|
|
meta.actor.hide();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
reset: function() {
|
|
|
|
this._searchSystem.reset();
|
2010-01-06 15:00:49 -05:00
|
|
|
this._statusText.hide();
|
2009-11-29 17:45:30 -05:00
|
|
|
this._clearDisplay();
|
|
|
|
},
|
|
|
|
|
|
|
|
startingSearch: function() {
|
|
|
|
this.reset();
|
2010-01-06 15:00:49 -05:00
|
|
|
this._statusText.set_text(_("Searching..."));
|
|
|
|
this._statusText.show();
|
2009-11-29 17:45:30 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
_metaForProvider: function(provider) {
|
|
|
|
return this._providerMeta[this._providers.indexOf(provider)];
|
|
|
|
},
|
|
|
|
|
|
|
|
updateSearch: function (searchString) {
|
|
|
|
let results = this._searchSystem.updateSearch(searchString);
|
|
|
|
|
|
|
|
this._clearDisplay();
|
|
|
|
|
2010-01-06 15:00:49 -05:00
|
|
|
if (results.length == 0) {
|
|
|
|
this._statusText.set_text(_("No matching results."));
|
|
|
|
this._statusText.show();
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
this._statusText.hide();
|
|
|
|
}
|
|
|
|
|
2009-11-29 17:45:30 -05:00
|
|
|
let terms = this._searchSystem.getTerms();
|
|
|
|
|
|
|
|
for (let i = 0; i < results.length; i++) {
|
|
|
|
let [provider, providerResults] = results[i];
|
|
|
|
let meta = this._metaForProvider(provider);
|
|
|
|
meta.actor.show();
|
|
|
|
meta.resultDisplay.renderResults(providerResults, terms);
|
2010-05-13 15:46:04 -04:00
|
|
|
meta.count.set_text('' + providerResults.length);
|
2009-11-29 17:45:30 -05:00
|
|
|
}
|
|
|
|
|
2009-12-18 10:39:02 -05:00
|
|
|
this.selectDown(false);
|
2009-11-29 17:45:30 -05:00
|
|
|
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
|
|
|
|
_onHeaderClicked: function(provider) {
|
|
|
|
provider.expandSearch(this._searchSystem.getTerms());
|
|
|
|
},
|
|
|
|
|
|
|
|
_modifyActorSelection: function(resultDisplay, up) {
|
|
|
|
let success;
|
|
|
|
let index = resultDisplay.getSelectionIndex();
|
|
|
|
if (up && index == -1)
|
2010-02-22 11:39:10 -05:00
|
|
|
index = resultDisplay.getVisibleResultCount() - 1;
|
2009-11-29 17:45:30 -05:00
|
|
|
else if (up)
|
|
|
|
index = index - 1;
|
|
|
|
else
|
|
|
|
index = index + 1;
|
|
|
|
return resultDisplay.selectIndex(index);
|
|
|
|
},
|
|
|
|
|
2009-12-18 10:39:02 -05:00
|
|
|
selectUp: function(recursing) {
|
2009-11-29 17:45:30 -05:00
|
|
|
for (let i = this._selectedProvider; i >= 0; i--) {
|
|
|
|
let meta = this._providerMeta[i];
|
|
|
|
if (!meta.actor.visible)
|
|
|
|
continue;
|
|
|
|
let success = this._modifyActorSelection(meta.resultDisplay, true);
|
|
|
|
if (success) {
|
|
|
|
this._selectedProvider = i;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2009-12-18 10:39:02 -05:00
|
|
|
if (this._providerMeta.length > 0 && !recursing) {
|
2009-11-29 17:45:30 -05:00
|
|
|
this._selectedProvider = this._providerMeta.length - 1;
|
2009-12-18 10:39:02 -05:00
|
|
|
this.selectUp(true);
|
2009-11-29 17:45:30 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2009-12-18 10:39:02 -05:00
|
|
|
selectDown: function(recursing) {
|
2009-11-29 17:45:30 -05:00
|
|
|
let current = this._selectedProvider;
|
|
|
|
if (current == -1)
|
|
|
|
current = 0;
|
|
|
|
for (let i = current; i < this._providerMeta.length; i++) {
|
|
|
|
let meta = this._providerMeta[i];
|
|
|
|
if (!meta.actor.visible)
|
|
|
|
continue;
|
|
|
|
let success = this._modifyActorSelection(meta.resultDisplay, false);
|
|
|
|
if (success) {
|
|
|
|
this._selectedProvider = i;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2009-12-18 10:39:02 -05:00
|
|
|
if (this._providerMeta.length > 0 && !recursing) {
|
2009-11-29 17:45:30 -05:00
|
|
|
this._selectedProvider = 0;
|
2009-12-18 10:39:02 -05:00
|
|
|
this.selectDown(true);
|
2009-11-29 17:45:30 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
activateSelected: function() {
|
|
|
|
let current = this._selectedProvider;
|
|
|
|
if (current < 0)
|
|
|
|
return;
|
|
|
|
let meta = this._providerMeta[current];
|
|
|
|
let resultDisplay = meta.resultDisplay;
|
2010-03-04 15:08:24 -05:00
|
|
|
resultDisplay.activateSelected();
|
|
|
|
Main.overview.hide();
|
2009-11-29 17:45:30 -05:00
|
|
|
}
|
2010-03-15 09:50:05 -04:00
|
|
|
};
|
2009-11-29 17:45:30 -05:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
function MoreLink() {
|
|
|
|
this._init();
|
|
|
|
}
|
|
|
|
|
|
|
|
MoreLink.prototype = {
|
|
|
|
_init : function () {
|
2010-05-13 15:46:04 -04:00
|
|
|
this.actor = new St.BoxLayout({ style_class: 'more-link',
|
2009-10-22 13:33:09 -04:00
|
|
|
reactive: true });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this.pane = null;
|
|
|
|
|
2010-05-13 15:46:04 -04:00
|
|
|
this._expander = new St.Bin({ style_class: 'more-link-expander' });
|
2010-02-15 19:50:36 -05:00
|
|
|
this.actor.add(this._expander, { expand: true, y_fill: false });
|
2009-11-14 20:11:20 -05:00
|
|
|
},
|
2009-08-09 19:48:54 -04:00
|
|
|
|
2009-11-14 20:11:20 -05:00
|
|
|
activate: function() {
|
|
|
|
if (this.pane == null) {
|
|
|
|
// Ensure the pane is created; the activated handler will call setPane
|
|
|
|
this.emit('activated');
|
|
|
|
}
|
|
|
|
this._pane.toggle();
|
|
|
|
return true;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
setPane: function (pane) {
|
|
|
|
this._pane = pane;
|
|
|
|
this._pane.connect('open-state-changed', Lang.bind(this, function(pane, isOpen) {
|
2010-03-19 11:37:04 -04:00
|
|
|
if (isOpen)
|
|
|
|
this._expander.add_style_class_name('open');
|
2010-02-15 19:50:36 -05:00
|
|
|
else
|
2010-03-19 11:37:04 -04:00
|
|
|
this._expander.remove_style_class_name('open');
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
}));
|
|
|
|
}
|
2010-03-15 09:50:05 -04:00
|
|
|
};
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
|
|
|
Signals.addSignalMethods(MoreLink.prototype);
|
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
function SectionHeader(title, suppressBrowse) {
|
|
|
|
this._init(title, suppressBrowse);
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
SectionHeader.prototype = {
|
2009-08-09 19:48:54 -04:00
|
|
|
_init : function (title, suppressBrowse) {
|
2010-05-13 15:46:04 -04:00
|
|
|
this.actor = new St.Bin({ style_class: 'section-header',
|
2009-10-22 13:33:09 -04:00
|
|
|
x_align: St.Align.START,
|
|
|
|
x_fill: true,
|
2009-11-14 20:11:20 -05:00
|
|
|
y_fill: true,
|
|
|
|
reactive: !suppressBrowse });
|
2010-05-13 15:46:04 -04:00
|
|
|
this._innerBox = new St.BoxLayout({ style_class: 'section-header-inner' });
|
2009-10-22 13:33:09 -04:00
|
|
|
this.actor.set_child(this._innerBox);
|
|
|
|
|
2010-05-13 15:46:04 -04:00
|
|
|
let textBox = new St.BoxLayout({ style_class: 'section-text-content' });
|
|
|
|
this.text = new St.Label({ style_class: 'section-title',
|
2009-10-22 13:33:09 -04:00
|
|
|
text: title });
|
|
|
|
textBox.add(this.text, { x_align: St.Align.START });
|
2009-09-01 19:06:20 -04:00
|
|
|
|
2009-10-22 13:33:09 -04:00
|
|
|
this._innerBox.add(textBox, { expand: true });
|
2009-08-28 13:37:03 -04:00
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
if (!suppressBrowse) {
|
|
|
|
this.moreLink = new MoreLink();
|
2009-10-22 13:33:09 -04:00
|
|
|
this._innerBox.add(this.moreLink.actor, { x_align: St.Align.END });
|
2009-11-14 20:11:20 -05:00
|
|
|
this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
|
2009-08-09 19:48:54 -04:00
|
|
|
}
|
2009-09-01 19:06:20 -04:00
|
|
|
},
|
|
|
|
|
2009-11-14 20:11:20 -05:00
|
|
|
_onButtonPress: function() {
|
|
|
|
this.moreLink.activate();
|
|
|
|
},
|
|
|
|
|
2009-09-25 14:54:40 -04:00
|
|
|
setMoreLinkVisible : function(visible) {
|
|
|
|
if (visible)
|
|
|
|
this.moreLink.actor.show();
|
|
|
|
else
|
|
|
|
this.moreLink.actor.hide();
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
}
|
2010-03-15 09:50:05 -04:00
|
|
|
};
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2009-09-01 19:06:20 -04:00
|
|
|
Signals.addSignalMethods(SectionHeader.prototype);
|
|
|
|
|
2009-08-26 18:46:58 -04:00
|
|
|
function SearchSectionHeader(title, onClick) {
|
|
|
|
this._init(title, onClick);
|
|
|
|
}
|
|
|
|
|
|
|
|
SearchSectionHeader.prototype = {
|
|
|
|
_init : function(title, onClick) {
|
2010-05-13 15:46:04 -04:00
|
|
|
this.actor = new St.Button({ style_class: 'dash-search-section-header',
|
2009-11-11 14:13:38 -05:00
|
|
|
x_fill: true,
|
|
|
|
y_fill: true });
|
|
|
|
let box = new St.BoxLayout();
|
|
|
|
this.actor.set_child(box);
|
2010-05-13 15:46:04 -04:00
|
|
|
let titleText = new St.Label({ style_class: 'dash-search-section-title',
|
2009-11-11 14:13:38 -05:00
|
|
|
text: title });
|
2010-05-13 15:46:04 -04:00
|
|
|
this.countText = new St.Label({ style_class: 'dash-search-section-count' });
|
2009-11-11 14:13:38 -05:00
|
|
|
|
|
|
|
box.add(titleText);
|
|
|
|
box.add(this.countText, { expand: true, x_fill: false, x_align: St.Align.END });
|
|
|
|
|
|
|
|
this.actor.connect('clicked', onClick);
|
2009-08-26 18:46:58 -04:00
|
|
|
}
|
2010-03-15 09:50:05 -04:00
|
|
|
};
|
2009-08-26 18:46:58 -04:00
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
function Section(titleString, suppressBrowse) {
|
|
|
|
this._init(titleString, suppressBrowse);
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
}
|
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
Section.prototype = {
|
|
|
|
_init: function(titleString, suppressBrowse) {
|
2009-11-06 16:08:07 -05:00
|
|
|
this.actor = new St.BoxLayout({ style_class: 'dash-section',
|
|
|
|
vertical: true });
|
2009-08-09 19:48:54 -04:00
|
|
|
this.header = new SectionHeader(titleString, suppressBrowse);
|
2009-11-06 16:08:07 -05:00
|
|
|
this.actor.add(this.header.actor);
|
|
|
|
this.content = new St.BoxLayout({ style_class: 'dash-section-content',
|
|
|
|
vertical: true });
|
|
|
|
this.actor.add(this.content);
|
2009-08-09 19:48:54 -04:00
|
|
|
}
|
2010-03-15 09:50:05 -04:00
|
|
|
};
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
function Dash() {
|
|
|
|
this._init();
|
|
|
|
}
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
Dash.prototype = {
|
|
|
|
_init : function() {
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
// dash and the popup panes need to be reactive so that the clicks in unoccupied places on them
|
|
|
|
// are not passed to the transparent background underneath them. This background is used for the workspaces area when
|
|
|
|
// the additional dash panes are being shown and it handles clicks by closing the additional panes, so that the user
|
|
|
|
// can interact with the workspaces. However, this behavior is not desirable when the click is actually over a pane.
|
|
|
|
//
|
|
|
|
// We have to make the individual panes reactive instead of making the whole dash actor reactive because the width
|
|
|
|
// of the Group actor ends up including the width of its hidden children, so we were getting a reactive object as
|
|
|
|
// wide as the details pane that was blocking the clicks to the workspaces underneath it even when the details pane
|
|
|
|
// was actually hidden.
|
2010-05-13 15:46:04 -04:00
|
|
|
this.actor = new St.BoxLayout({ name: 'dash',
|
2009-10-22 13:33:09 -04:00
|
|
|
vertical: true,
|
|
|
|
reactive: true });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2009-11-29 17:45:30 -05:00
|
|
|
// The searchArea just holds the entry
|
2010-05-13 15:46:04 -04:00
|
|
|
this.searchArea = new St.BoxLayout({ name: 'dashSearchArea',
|
2009-11-29 17:45:30 -05:00
|
|
|
vertical: true });
|
2010-05-13 15:46:04 -04:00
|
|
|
this.sectionArea = new St.BoxLayout({ name: 'dashSections',
|
2009-11-06 17:32:23 -05:00
|
|
|
vertical: true });
|
2009-08-09 19:48:54 -04:00
|
|
|
|
2009-10-22 13:33:09 -04:00
|
|
|
this.actor.add(this.searchArea);
|
|
|
|
this.actor.add(this.sectionArea);
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
|
|
|
// The currently active popup display
|
|
|
|
this._activePane = null;
|
|
|
|
|
|
|
|
/***** Search *****/
|
|
|
|
|
|
|
|
this._searchActive = false;
|
2009-09-24 18:34:43 -04:00
|
|
|
this._searchPending = false;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this._searchEntry = new SearchEntry();
|
2009-11-29 17:45:30 -05:00
|
|
|
this.searchArea.add(this._searchEntry.actor, { y_fill: false, expand: true });
|
|
|
|
|
|
|
|
this._searchSystem = new Search.SearchSystem();
|
|
|
|
this._searchSystem.registerProvider(new AppDisplay.AppSearchProvider());
|
|
|
|
this._searchSystem.registerProvider(new AppDisplay.PrefsSearchProvider());
|
|
|
|
this._searchSystem.registerProvider(new PlaceDisplay.PlaceSearchProvider());
|
|
|
|
this._searchSystem.registerProvider(new DocDisplay.DocSearchProvider());
|
|
|
|
|
|
|
|
this.searchResults = new SearchResults(this._searchSystem);
|
|
|
|
this.actor.add(this.searchResults.actor);
|
|
|
|
this.searchResults.actor.hide();
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2010-02-27 09:49:39 -05:00
|
|
|
this._keyPressId = 0;
|
2009-08-12 19:37:47 -04:00
|
|
|
this._searchTimeoutId = 0;
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
this._searchEntry.entry.connect('text-changed', Lang.bind(this, function (se, prop) {
|
2009-09-24 18:34:43 -04:00
|
|
|
let searchPreviouslyActive = this._searchActive;
|
2010-02-27 09:49:39 -05:00
|
|
|
this._searchActive = this._searchEntry.isActive();
|
2009-09-24 18:34:43 -04:00
|
|
|
this._searchPending = this._searchActive && !searchPreviouslyActive;
|
2009-11-29 17:45:30 -05:00
|
|
|
if (this._searchPending) {
|
|
|
|
this.searchResults.startingSearch();
|
|
|
|
}
|
|
|
|
if (this._searchActive) {
|
|
|
|
this.searchResults.actor.show();
|
|
|
|
this.sectionArea.hide();
|
|
|
|
} else {
|
|
|
|
this.searchResults.actor.hide();
|
|
|
|
this.sectionArea.show();
|
|
|
|
}
|
2009-08-12 17:07:00 -04:00
|
|
|
if (!this._searchActive) {
|
2009-08-13 13:11:21 -04:00
|
|
|
if (this._searchTimeoutId > 0) {
|
2009-08-12 19:37:47 -04:00
|
|
|
Mainloop.source_remove(this._searchTimeoutId);
|
2009-08-13 13:11:21 -04:00
|
|
|
this._searchTimeoutId = 0;
|
|
|
|
}
|
2009-08-12 17:07:00 -04:00
|
|
|
return;
|
|
|
|
}
|
2009-08-12 19:37:47 -04:00
|
|
|
if (this._searchTimeoutId > 0)
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
return;
|
2009-10-13 14:18:47 -04:00
|
|
|
this._searchTimeoutId = Mainloop.timeout_add(150, Lang.bind(this, this._doSearch));
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
}));
|
|
|
|
this._searchEntry.entry.connect('activate', Lang.bind(this, function (se) {
|
2009-10-13 14:18:47 -04:00
|
|
|
if (this._searchTimeoutId > 0) {
|
|
|
|
Mainloop.source_remove(this._searchTimeoutId);
|
|
|
|
this._doSearch();
|
|
|
|
}
|
2009-11-29 17:45:30 -05:00
|
|
|
this.searchResults.activateSelected();
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
return true;
|
|
|
|
}));
|
|
|
|
|
|
|
|
/***** Applications *****/
|
|
|
|
|
2009-08-21 18:21:35 -04:00
|
|
|
this._appsSection = new Section(_("APPLICATIONS"));
|
2009-08-09 19:48:54 -04:00
|
|
|
let appWell = new AppDisplay.AppWell();
|
2009-11-06 16:08:07 -05:00
|
|
|
this._appsSection.content.add(appWell.actor, { expand: true });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2010-02-15 19:50:36 -05:00
|
|
|
this._allApps = null;
|
2009-08-21 18:21:35 -04:00
|
|
|
this._appsSection.header.moreLink.connect('activated', Lang.bind(this, function (link) {
|
2010-02-15 19:50:36 -05:00
|
|
|
if (this._allApps == null) {
|
|
|
|
this._allApps = new AppDisplay.AllAppDisplay();
|
2010-03-10 10:54:00 -05:00
|
|
|
this._addPane(this._allApps, St.Align.START);
|
2010-02-15 19:50:36 -05:00
|
|
|
link.setPane(this._allApps);
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
}
|
|
|
|
}));
|
|
|
|
|
2009-11-06 17:32:23 -05:00
|
|
|
this.sectionArea.add(this._appsSection.actor);
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2009-08-06 09:06:33 -04:00
|
|
|
/***** Places *****/
|
|
|
|
|
2009-08-17 08:53:59 -04:00
|
|
|
/* Translators: This is in the sense of locations for documents,
|
|
|
|
network locations, etc. */
|
2009-12-25 12:41:58 -05:00
|
|
|
this._placesSection = new Section(_("PLACES & DEVICES"), true);
|
2009-10-31 22:25:28 -04:00
|
|
|
let placesDisplay = new PlaceDisplay.DashPlaceDisplay();
|
2009-11-06 16:08:07 -05:00
|
|
|
this._placesSection.content.add(placesDisplay.actor, { expand: true });
|
2009-11-06 17:32:23 -05:00
|
|
|
this.sectionArea.add(this._placesSection.actor);
|
2009-08-06 09:06:33 -04:00
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
/***** Documents *****/
|
|
|
|
|
2009-12-25 12:41:58 -05:00
|
|
|
this._docsSection = new Section(_("RECENT ITEMS"));
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2009-09-25 14:54:40 -04:00
|
|
|
this._docDisplay = new DocDisplay.DashDocDisplay();
|
2009-11-06 16:08:07 -05:00
|
|
|
this._docsSection.content.add(this._docDisplay.actor, { expand: true });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
|
2009-08-09 19:48:54 -04:00
|
|
|
this._moreDocsPane = null;
|
2009-08-21 18:21:35 -04:00
|
|
|
this._docsSection.header.moreLink.connect('activated', Lang.bind(this, function (link) {
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
if (this._moreDocsPane == null) {
|
2009-08-09 19:48:54 -04:00
|
|
|
this._moreDocsPane = new ResultPane(this);
|
2010-03-10 10:54:00 -05:00
|
|
|
this._addPane(this._moreDocsPane, St.Align.END);
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
link.setPane(this._moreDocsPane);
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
|
2009-09-25 14:54:40 -04:00
|
|
|
this._docDisplay.connect('changed', Lang.bind(this, function () {
|
|
|
|
this._docsSection.header.setMoreLinkVisible(
|
|
|
|
this._docDisplay.actor.get_children().length > 0);
|
|
|
|
}));
|
|
|
|
this._docDisplay.emit('changed');
|
|
|
|
|
2009-11-06 17:32:23 -05:00
|
|
|
this.sectionArea.add(this._docsSection.actor, { expand: true });
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
},
|
|
|
|
|
2010-02-27 09:49:39 -05:00
|
|
|
_onKeyPress: function(stage, event) {
|
|
|
|
// If neither the stage nor the search entry have key focus, some
|
|
|
|
// "special" actor grabbed the focus (run dialog, looking glass);
|
|
|
|
// we don't want to interfere with that
|
|
|
|
let focus = stage.get_key_focus();
|
|
|
|
if (focus != stage && focus != this._searchEntry.entry)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
let symbol = event.get_key_symbol();
|
|
|
|
if (symbol == Clutter.Escape) {
|
|
|
|
// If we're in one of the "more" modes or showing the
|
|
|
|
// details pane, close them
|
|
|
|
if (this._activePane != null)
|
|
|
|
this._activePane.close();
|
|
|
|
// Otherwise, just close the Overview entirely
|
|
|
|
else
|
|
|
|
Main.overview.hide();
|
|
|
|
return true;
|
|
|
|
} else if (symbol == Clutter.Up) {
|
|
|
|
if (!this._searchActive)
|
|
|
|
return true;
|
|
|
|
this.searchResults.selectUp(false);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
} else if (symbol == Clutter.Down) {
|
|
|
|
if (!this._searchActive)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
this.searchResults.selectDown(false);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
2009-10-13 14:18:47 -04:00
|
|
|
_doSearch: function () {
|
|
|
|
this._searchTimeoutId = 0;
|
|
|
|
let text = this._searchEntry.getText();
|
2009-11-29 17:45:30 -05:00
|
|
|
this.searchResults.updateSearch(text);
|
2009-11-03 18:36:44 -05:00
|
|
|
|
2009-10-13 14:18:47 -04:00
|
|
|
return false;
|
|
|
|
},
|
|
|
|
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
show: function() {
|
2010-02-27 09:49:39 -05:00
|
|
|
this._searchEntry.show();
|
|
|
|
if (this._keyPressId == 0)
|
|
|
|
this._keyPressId = global.stage.connect('key-press-event',
|
|
|
|
Lang.bind(this, this._onKeyPress));
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
hide: function() {
|
2009-08-09 19:48:54 -04:00
|
|
|
this._firstSelectAfterOverlayShow = true;
|
2010-02-27 09:49:39 -05:00
|
|
|
this._searchEntry.hide();
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
if (this._activePane != null)
|
|
|
|
this._activePane.close();
|
2010-02-27 09:49:39 -05:00
|
|
|
if (this._keyPressId > 0) {
|
|
|
|
global.stage.disconnect(this._keyPressId);
|
|
|
|
this._keyPressId = 0;
|
|
|
|
}
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
closePanes: function () {
|
|
|
|
if (this._activePane != null)
|
|
|
|
this._activePane.close();
|
|
|
|
},
|
|
|
|
|
2010-03-10 10:54:00 -05:00
|
|
|
_addPane: function(pane, align) {
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
pane.connect('open-state-changed', Lang.bind(this, function (pane, isOpen) {
|
|
|
|
if (isOpen) {
|
|
|
|
if (pane != this._activePane && this._activePane != null) {
|
|
|
|
this._activePane.close();
|
|
|
|
}
|
|
|
|
this._activePane = pane;
|
|
|
|
} else if (pane == this._activePane) {
|
|
|
|
this._activePane = null;
|
|
|
|
}
|
|
|
|
}));
|
2010-03-10 10:54:00 -05:00
|
|
|
Main.overview.addPane(pane, align);
|
Rewrite Dash, remove hardcoded width/height from GenericDisplay
This patch is a near-total rewrite of the Dash. First, the dash
code moves into a separate file, dash.js.
Inside dash.js, the components are more broken up into separate
classes; in particular there's now a Pane class and a MoreLink
class. Instead of each section of the dash, when activated,
attempting to close all N-1 other sections, instead there
is the concept of a single "active pane", and when e.g. activating
the More link for documents, if we know there's an active pane
which happens to be the apps, close it.
Many redundant containers were removed from the dash, and all
manual width, height and x/y offsets are entirely gone. We move
the visual apperance closer to the design by using the view-more.svg,
etc.
To complete the removal of height/width calculations from the dash,
we also had to do the same for GenericDisplay. Also clean up
the positioning inside overlay.js so calculation of children's
positioning is inside a single function that flows from screen.width
and screen.height, so in the future we can stop passing the width
into the Dash constructor and call this once and work on screen
resizing.
2009-07-31 22:12:01 -04:00
|
|
|
}
|
|
|
|
};
|
|
|
|
Signals.addSignalMethods(Dash.prototype);
|