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-08-01 02:12:01 +00:00
|
|
|
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
|
|
|
|
|
|
|
|
const Big = imports.gi.Big;
|
|
|
|
const Clutter = imports.gi.Clutter;
|
|
|
|
const Gtk = imports.gi.Gtk;
|
|
|
|
const Mainloop = imports.mainloop;
|
2009-08-09 23:48:54 +00: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-08-01 02:12:01 +00:00
|
|
|
const Shell = imports.gi.Shell;
|
|
|
|
const Signals = imports.signals;
|
|
|
|
const Lang = imports.lang;
|
2009-10-22 17:33:09 +00:00
|
|
|
const St = imports.gi.St;
|
2009-08-14 13:30:48 +00: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-08-01 02:12:01 +00:00
|
|
|
|
|
|
|
const AppDisplay = imports.ui.appDisplay;
|
|
|
|
const DocDisplay = imports.ui.docDisplay;
|
2009-11-01 02:25:28 +00: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-08-01 02:12:01 +00:00
|
|
|
const GenericDisplay = imports.ui.genericDisplay;
|
|
|
|
const Main = imports.ui.main;
|
|
|
|
|
|
|
|
const DEFAULT_PADDING = 4;
|
2009-08-28 17:37:03 +00:00
|
|
|
const DEFAULT_SPACING = 4;
|
2009-08-09 23:48:54 +00:00
|
|
|
|
|
|
|
const BACKGROUND_COLOR = new Clutter.Color();
|
|
|
|
BACKGROUND_COLOR.from_pixel(0x000000c0);
|
|
|
|
|
2009-08-26 22:46:58 +00:00
|
|
|
const PRELIGHT_COLOR = new Clutter.Color();
|
|
|
|
PRELIGHT_COLOR.from_pixel(0x4f6fadaa);
|
|
|
|
|
2009-08-15 20:32:58 +00:00
|
|
|
const TEXT_COLOR = new Clutter.Color();
|
|
|
|
TEXT_COLOR.from_pixel(0x5f5f5fff);
|
2009-08-28 17:37:03 +00:00
|
|
|
const BRIGHTER_TEXT_COLOR = new Clutter.Color();
|
|
|
|
BRIGHTER_TEXT_COLOR.from_pixel(0xbbbbbbff);
|
2009-08-15 20:32:58 +00:00
|
|
|
const BRIGHT_TEXT_COLOR = new Clutter.Color();
|
|
|
|
BRIGHT_TEXT_COLOR.from_pixel(0xffffffff);
|
|
|
|
const SEARCH_TEXT_COLOR = new Clutter.Color();
|
|
|
|
SEARCH_TEXT_COLOR.from_pixel(0x333333ff);
|
|
|
|
|
|
|
|
const SEARCH_CURSOR_COLOR = BRIGHT_TEXT_COLOR;
|
|
|
|
const HIGHLIGHTED_SEARCH_CURSOR_COLOR = SEARCH_TEXT_COLOR;
|
|
|
|
|
2009-08-09 23:48:54 +00:00
|
|
|
const SEARCH_BORDER_BOTTOM_COLOR = new Clutter.Color();
|
|
|
|
SEARCH_BORDER_BOTTOM_COLOR.from_pixel(0x191919ff);
|
|
|
|
|
|
|
|
const BROWSE_ACTIVATED_BG = new Clutter.Color();
|
|
|
|
BROWSE_ACTIVATED_BG.from_pixel(0x303030f0);
|
|
|
|
|
2009-09-11 21:48:02 +00:00
|
|
|
const APPS = "apps";
|
|
|
|
const PREFS = "prefs";
|
|
|
|
const DOCS = "docs";
|
2009-11-01 02:25:28 +00:00
|
|
|
const PLACES = "places";
|
2009-09-11 21:48:02 +00:00
|
|
|
|
2009-09-11 20:42:54 +00: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 22:49:01 +00:00
|
|
|
*
|
2009-09-11 20:42:54 +00: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;
|
|
|
|
}
|
|
|
|
|
2009-11-03 23:36:44 +00:00
|
|
|
function _createDisplay(displayType, flags) {
|
2009-09-11 21:48:02 +00:00
|
|
|
if (displayType == APPS)
|
2009-11-03 23:36:44 +00:00
|
|
|
return new AppDisplay.AppDisplay(false, flags);
|
2009-09-11 21:48:02 +00:00
|
|
|
else if (displayType == PREFS)
|
2009-11-03 23:36:44 +00:00
|
|
|
return new AppDisplay.AppDisplay(true, flags);
|
2009-09-11 21:48:02 +00:00
|
|
|
else if (displayType == DOCS)
|
2009-11-03 23:36:44 +00:00
|
|
|
return new DocDisplay.DocDisplay(flags);
|
2009-11-01 02:25:28 +00:00
|
|
|
else if (displayType == PLACES)
|
2009-11-03 23:36:44 +00:00
|
|
|
return new PlaceDisplay.PlaceDisplay(flags);
|
2009-09-11 21:48:02 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
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-08-01 02:12:01 +00:00
|
|
|
function Pane() {
|
|
|
|
this._init();
|
|
|
|
}
|
|
|
|
|
|
|
|
Pane.prototype = {
|
|
|
|
_init: function () {
|
|
|
|
this._open = false;
|
|
|
|
|
2009-11-06 19:55:03 +00:00
|
|
|
this.actor = new St.BoxLayout({ style_class: "dash-pane",
|
|
|
|
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-08-01 02:12:01 +00: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;
|
|
|
|
}));
|
|
|
|
|
2009-11-06 19:55:03 +00:00
|
|
|
let chromeTop = new St.BoxLayout();
|
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-08-01 02:12:01 +00:00
|
|
|
|
2009-11-12 18:09:20 +00:00
|
|
|
let closeIcon = new St.Button({ style_class: "dash-pane-close" });
|
|
|
|
closeIcon.connect('clicked', Lang.bind(this, function (b, e) {
|
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-08-01 02:12:01 +00:00
|
|
|
this.close();
|
|
|
|
}));
|
2009-11-06 19:55:03 +00:00
|
|
|
let dummy = new St.Bin();
|
|
|
|
chromeTop.add(dummy, { expand: true });
|
|
|
|
chromeTop.add(closeIcon, { x_align: St.Align.END });
|
|
|
|
this.actor.add(chromeTop);
|
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-08-01 02:12:01 +00:00
|
|
|
|
2009-11-06 19:55:03 +00:00
|
|
|
this.content = new St.BoxLayout({ vertical: true });
|
|
|
|
this.actor.add(this.content, { 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-08-01 02:12:01 +00:00
|
|
|
|
|
|
|
// Hidden by default
|
|
|
|
this.actor.hide();
|
|
|
|
},
|
|
|
|
|
|
|
|
open: function () {
|
|
|
|
if (this._open)
|
|
|
|
return;
|
|
|
|
this._open = true;
|
|
|
|
this.actor.show();
|
|
|
|
this.emit('open-state-changed', this._open);
|
|
|
|
},
|
|
|
|
|
|
|
|
close: function () {
|
|
|
|
if (!this._open)
|
|
|
|
return;
|
|
|
|
this._open = false;
|
|
|
|
this.actor.hide();
|
|
|
|
this.emit('open-state-changed', this._open);
|
|
|
|
},
|
|
|
|
|
|
|
|
destroyContent: function() {
|
|
|
|
let children = this.content.get_children();
|
|
|
|
for (let i = 0; i < children.length; i++) {
|
|
|
|
children[i].destroy();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
toggle: function () {
|
|
|
|
if (this._open)
|
|
|
|
this.close();
|
|
|
|
else
|
|
|
|
this.open();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Signals.addSignalMethods(Pane.prototype);
|
|
|
|
|
2009-11-03 23:36:44 +00:00
|
|
|
function ResultArea(displayType, flags) {
|
|
|
|
this._init(displayType, flags);
|
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-08-01 02:12:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ResultArea.prototype = {
|
2009-11-03 23:36:44 +00:00
|
|
|
_init : function(displayType, flags) {
|
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-08-01 02:12:01 +00:00
|
|
|
this.actor = new Big.Box({ orientation: Big.BoxOrientation.VERTICAL });
|
|
|
|
this.resultsContainer = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL,
|
|
|
|
spacing: DEFAULT_PADDING
|
|
|
|
});
|
|
|
|
this.actor.append(this.resultsContainer, Big.BoxPackFlags.EXPAND);
|
|
|
|
|
2009-11-03 23:36:44 +00:00
|
|
|
this.display = _createDisplay(displayType, flags);
|
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-08-01 02:12:01 +00:00
|
|
|
this.resultsContainer.append(this.display.actor, Big.BoxPackFlags.EXPAND);
|
|
|
|
this.display.load();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Utility function shared between ResultPane and the DocDisplay in the main dash.
|
|
|
|
// Connects to the detail signal of the display, and on-demand creates a new
|
|
|
|
// pane.
|
2009-08-09 23:48:54 +00:00
|
|
|
function createPaneForDetails(dash, display) {
|
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-08-01 02:12:01 +00:00
|
|
|
let detailPane = null;
|
|
|
|
display.connect('show-details', Lang.bind(this, function(display, index) {
|
|
|
|
if (detailPane == null) {
|
|
|
|
detailPane = new Pane();
|
|
|
|
detailPane.connect('open-state-changed', Lang.bind(this, function (pane, isOpen) {
|
|
|
|
if (!isOpen) {
|
|
|
|
/* Ensure we don't keep around large preview textures */
|
|
|
|
detailPane.destroyContent();
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
dash._addPane(detailPane);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (index >= 0) {
|
|
|
|
detailPane.destroyContent();
|
2009-08-12 20:33:39 +00:00
|
|
|
let details = display.createDetailsForIndex(index);
|
2009-11-06 19:55:03 +00:00
|
|
|
detailPane.content.add(details, { 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-08-01 02:12:01 +00:00
|
|
|
detailPane.open();
|
|
|
|
} else {
|
|
|
|
detailPane.close();
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2009-08-09 23:48:54 +00: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-08-01 02:12:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ResultPane.prototype = {
|
|
|
|
__proto__: Pane.prototype,
|
|
|
|
|
2009-08-09 23:48:54 +00: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-08-01 02:12:01 +00:00
|
|
|
Pane.prototype._init.call(this);
|
|
|
|
this._dash = dash;
|
|
|
|
},
|
|
|
|
|
2009-09-11 21:48:02 +00:00
|
|
|
// Create a display of displayType and pack it into this pane's
|
|
|
|
// content area. Return the display.
|
2009-11-03 23:36:44 +00:00
|
|
|
packResults: function(displayType) {
|
|
|
|
let resultArea = new ResultArea(displayType);
|
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-08-01 02:12:01 +00:00
|
|
|
|
2009-08-09 23:48:54 +00:00
|
|
|
createPaneForDetails(this._dash, resultArea.display);
|
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-08-01 02:12:01 +00:00
|
|
|
|
2009-11-06 19:55:03 +00:00
|
|
|
this.content.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-08-01 02:12:01 +00:00
|
|
|
this.connect('open-state-changed', Lang.bind(this, function(pane, isOpen) {
|
|
|
|
resultArea.display.resetState();
|
|
|
|
}));
|
|
|
|
return resultArea.display;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function SearchEntry() {
|
|
|
|
this._init();
|
|
|
|
}
|
|
|
|
|
|
|
|
SearchEntry.prototype = {
|
|
|
|
_init : function() {
|
2009-10-22 17:33:09 +00:00
|
|
|
this.actor = new St.BoxLayout({ name: "searchEntry",
|
|
|
|
reactive: true });
|
2009-08-16 14:09:34 +00:00
|
|
|
let box = new Big.Box({ orientation: Big.BoxOrientation.HORIZONTAL,
|
|
|
|
y_align: Big.BoxAlignment.CENTER });
|
2009-10-22 17:33:09 +00:00
|
|
|
this.actor.add(box, { expand: true });
|
2009-08-15 20:32:58 +00:00
|
|
|
this.actor.connect('button-press-event', Lang.bind(this, function () {
|
|
|
|
this._resetTextState(true);
|
|
|
|
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-08-01 02:12:01 +00:00
|
|
|
this.pane = null;
|
|
|
|
|
2009-08-28 15:56:40 +00:00
|
|
|
this._defaultText = _("Find...");
|
2009-08-09 23:48:54 +00:00
|
|
|
|
2009-08-28 20:21:21 +00:00
|
|
|
let textProperties = { font_name: "Sans 16px" };
|
2009-08-09 23:48:54 +00:00
|
|
|
let entryProperties = { editable: true,
|
|
|
|
activatable: true,
|
|
|
|
single_line_mode: true,
|
2009-08-15 20:32:58 +00:00
|
|
|
color: SEARCH_TEXT_COLOR,
|
|
|
|
cursor_color: SEARCH_CURSOR_COLOR };
|
2009-08-09 23:48:54 +00:00
|
|
|
Lang.copyProperties(textProperties, entryProperties);
|
|
|
|
this.entry = new Clutter.Text(entryProperties);
|
2009-08-15 20:32:58 +00:00
|
|
|
|
2009-08-09 23:48:54 +00:00
|
|
|
this.entry.connect('notify::text', Lang.bind(this, function () {
|
2009-08-15 20:32:58 +00:00
|
|
|
this._resetTextState(false);
|
2009-08-09 23:48:54 +00:00
|
|
|
}));
|
2009-08-16 14:09:34 +00:00
|
|
|
box.append(this.entry, Big.BoxPackFlags.EXPAND);
|
2009-08-09 23:48:54 +00:00
|
|
|
|
|
|
|
// Mark as editable just to get a cursor
|
|
|
|
let defaultTextProperties = { ellipsize: Pango.EllipsizeMode.END,
|
2009-08-14 22:13:55 +00:00
|
|
|
text: this._defaultText,
|
2009-08-09 23:48:54 +00:00
|
|
|
editable: true,
|
|
|
|
color: TEXT_COLOR,
|
|
|
|
cursor_visible: false,
|
|
|
|
single_line_mode: true };
|
|
|
|
Lang.copyProperties(textProperties, defaultTextProperties);
|
|
|
|
this._defaultText = new Clutter.Text(defaultTextProperties);
|
2009-08-16 14:09:34 +00:00
|
|
|
box.add_actor(this._defaultText);
|
2009-08-09 23:48:54 +00:00
|
|
|
this.entry.connect('notify::allocation', Lang.bind(this, function () {
|
|
|
|
this._repositionDefaultText();
|
|
|
|
}));
|
|
|
|
|
|
|
|
this._iconBox = new Big.Box({ x_align: Big.BoxAlignment.CENTER,
|
2009-08-16 14:09:34 +00:00
|
|
|
y_align: Big.BoxAlignment.CENTER,
|
|
|
|
padding_right: 4 });
|
|
|
|
box.append(this._iconBox, Big.BoxPackFlags.END);
|
2009-08-09 23:48:54 +00:00
|
|
|
|
|
|
|
let magnifierUri = "file://" + global.imagedir + "magnifier.svg";
|
|
|
|
this._magnifierIcon = Shell.TextureCache.get_default().load_uri_sync(Shell.TextureCachePolicy.FOREVER,
|
2009-08-16 14:09:34 +00:00
|
|
|
magnifierUri, 18, 18);
|
|
|
|
let closeUri = "file://" + global.imagedir + "close-black.svg";
|
2009-08-09 23:48:54 +00:00
|
|
|
this._closeIcon = Shell.TextureCache.get_default().load_uri_sync(Shell.TextureCachePolicy.FOREVER,
|
|
|
|
closeUri, 18, 18);
|
|
|
|
this._closeIcon.reactive = true;
|
|
|
|
this._closeIcon.connect('button-press-event', Lang.bind(this, function () {
|
2009-08-15 20:32:58 +00:00
|
|
|
// Resetting this.entry.text will trigger notify::text signal which will
|
|
|
|
// result in this._resetTextState() being called, but we should not rely
|
|
|
|
// on that not short-circuiting if the text was already empty, so we call
|
|
|
|
// this._resetTextState() explicitly in that case.
|
|
|
|
if (this.entry.text == '')
|
|
|
|
this._resetTextState(false);
|
|
|
|
else
|
|
|
|
this.entry.text = '';
|
|
|
|
|
2009-11-09 22:49:01 +00:00
|
|
|
// Return true to stop the signal emission, so that this.actor doesn't get
|
2009-08-15 20:32:58 +00:00
|
|
|
// the button-press-event and re-highlight itself.
|
|
|
|
return true;
|
2009-08-09 23:48:54 +00:00
|
|
|
}));
|
|
|
|
this._repositionDefaultText();
|
|
|
|
this._resetTextState();
|
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-08-01 02:12:01 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setPane: function (pane) {
|
|
|
|
this._pane = pane;
|
2009-08-09 23:48:54 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
reset: function () {
|
|
|
|
this.entry.text = '';
|
|
|
|
},
|
|
|
|
|
|
|
|
getText: function () {
|
|
|
|
return this.entry.text;
|
|
|
|
},
|
|
|
|
|
2009-08-15 20:32:58 +00:00
|
|
|
_resetTextState: function (searchEntryClicked) {
|
2009-08-09 23:48:54 +00:00
|
|
|
let text = this.getText();
|
|
|
|
this._iconBox.remove_all();
|
2009-11-09 22:49:01 +00:00
|
|
|
// We highlight the search box if the user starts typing in it
|
2009-08-15 20:32:58 +00:00
|
|
|
// or just clicks in it to indicate that the search is active.
|
|
|
|
if (text != '' || searchEntryClicked) {
|
|
|
|
if (!searchEntryClicked)
|
|
|
|
this._defaultText.hide();
|
2009-08-09 23:48:54 +00:00
|
|
|
this._iconBox.append(this._closeIcon, Big.BoxPackFlags.NONE);
|
2009-10-22 17:33:09 +00:00
|
|
|
this.actor.set_style_pseudo_class('active');
|
2009-08-15 20:32:58 +00:00
|
|
|
this.entry.cursor_color = HIGHLIGHTED_SEARCH_CURSOR_COLOR;
|
2009-08-09 23:48:54 +00:00
|
|
|
} else {
|
|
|
|
this._defaultText.show();
|
|
|
|
this._iconBox.append(this._magnifierIcon, Big.BoxPackFlags.NONE);
|
2009-10-22 17:33:09 +00:00
|
|
|
this.actor.set_style_pseudo_class(null);
|
2009-08-15 20:32:58 +00:00
|
|
|
this.entry.cursor_color = SEARCH_CURSOR_COLOR;
|
2009-08-09 23:48:54 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
_repositionDefaultText: function () {
|
|
|
|
// Offset a little to show the cursor
|
|
|
|
this._defaultText.set_position(this.entry.x + 4, this.entry.y);
|
|
|
|
this._defaultText.set_size(this.entry.width, this.entry.height);
|
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-08-01 02:12:01 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
Signals.addSignalMethods(SearchEntry.prototype);
|
|
|
|
|
|
|
|
function MoreLink() {
|
|
|
|
this._init();
|
|
|
|
}
|
|
|
|
|
|
|
|
MoreLink.prototype = {
|
|
|
|
_init : function () {
|
2009-10-22 17:33:09 +00:00
|
|
|
this.actor = new St.BoxLayout({ style_class: "more-link",
|
|
|
|
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-08-01 02:12:01 +00:00
|
|
|
this.pane = null;
|
|
|
|
|
2009-11-06 23:32:41 +00:00
|
|
|
let expander = new St.Bin({ style_class: "more-link-expander" });
|
|
|
|
this.actor.add(expander, { expand: true, y_fill: false });
|
2009-08-09 23:48:54 +00:00
|
|
|
|
|
|
|
this.actor.connect('button-press-event', Lang.bind(this, function (b, e) {
|
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-08-01 02:12:01 +00:00
|
|
|
if (this.pane == null) {
|
|
|
|
// Ensure the pane is created; the activated handler will call setPane
|
|
|
|
this.emit('activated');
|
|
|
|
}
|
|
|
|
this._pane.toggle();
|
|
|
|
return true;
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
|
|
|
|
setPane: function (pane) {
|
|
|
|
this._pane = pane;
|
|
|
|
this._pane.connect('open-state-changed', Lang.bind(this, function(pane, isOpen) {
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Signals.addSignalMethods(MoreLink.prototype);
|
|
|
|
|
2009-09-01 23:06:20 +00:00
|
|
|
function BackLink() {
|
|
|
|
this._init();
|
|
|
|
}
|
|
|
|
|
|
|
|
BackLink.prototype = {
|
|
|
|
_init : function () {
|
2009-11-10 15:02:02 +00:00
|
|
|
this.actor = new St.Button({ style_class: "section-header-back",
|
|
|
|
reactive: true });
|
|
|
|
this.actor.set_child(new St.Bin({ style_class: "section-header-back-image" }));
|
2009-09-01 23:06:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-09 23:48:54 +00: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-08-01 02:12:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SectionHeader.prototype = {
|
2009-08-09 23:48:54 +00:00
|
|
|
_init : function (title, suppressBrowse) {
|
2009-10-22 17:33:09 +00:00
|
|
|
this.actor = new St.Bin({ style_class: "section-header",
|
|
|
|
x_align: St.Align.START,
|
|
|
|
x_fill: true,
|
|
|
|
y_fill: true });
|
|
|
|
this._innerBox = new St.BoxLayout({ style_class: "section-header-inner" });
|
|
|
|
this.actor.set_child(this._innerBox);
|
|
|
|
|
2009-11-10 15:02:02 +00:00
|
|
|
this.backLink = new BackLink();
|
|
|
|
this._innerBox.add(this.backLink.actor);
|
|
|
|
this.backLink.actor.hide();
|
|
|
|
this.backLink.actor.connect('clicked', Lang.bind(this, function (actor) {
|
|
|
|
this.emit('back-link-activated');
|
|
|
|
}));
|
|
|
|
|
2009-10-22 17:33:09 +00:00
|
|
|
let textBox = new St.BoxLayout({ style_class: "section-text-content" });
|
|
|
|
this.text = new St.Label({ style_class: "section-title",
|
|
|
|
text: title });
|
|
|
|
textBox.add(this.text, { x_align: St.Align.START });
|
2009-09-01 23:06:20 +00:00
|
|
|
|
2009-10-22 17:33:09 +00:00
|
|
|
this.countText = new St.Label({ style_class: "section-count" });
|
2009-11-10 15:02:02 +00:00
|
|
|
textBox.add(this.countText, { expand: true, x_fill: false, x_align: St.Align.END });
|
2009-09-01 23:06:20 +00:00
|
|
|
this.countText.hide();
|
|
|
|
|
2009-10-22 17:33:09 +00:00
|
|
|
this._innerBox.add(textBox, { expand: true });
|
2009-08-28 17:37:03 +00:00
|
|
|
|
2009-08-09 23:48:54 +00:00
|
|
|
if (!suppressBrowse) {
|
|
|
|
this.moreLink = new MoreLink();
|
2009-10-22 17:33:09 +00:00
|
|
|
this._innerBox.add(this.moreLink.actor, { x_align: St.Align.END });
|
2009-08-09 23:48:54 +00:00
|
|
|
}
|
2009-09-01 23:06:20 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
setTitle : function(title) {
|
|
|
|
this.text.text = title;
|
|
|
|
},
|
|
|
|
|
|
|
|
setBackLinkVisible : function(visible) {
|
|
|
|
if (visible)
|
|
|
|
this.backLink.actor.show();
|
|
|
|
else
|
|
|
|
this.backLink.actor.hide();
|
|
|
|
},
|
|
|
|
|
2009-09-25 18:54:40 +00:00
|
|
|
setMoreLinkVisible : function(visible) {
|
|
|
|
if (visible)
|
|
|
|
this.moreLink.actor.show();
|
|
|
|
else
|
|
|
|
this.moreLink.actor.hide();
|
|
|
|
},
|
|
|
|
|
2009-09-01 23:06:20 +00:00
|
|
|
setCountText : function(countText) {
|
|
|
|
if (countText == "") {
|
|
|
|
this.countText.hide();
|
|
|
|
} else {
|
|
|
|
this.countText.show();
|
|
|
|
this.countText.text = countText;
|
|
|
|
}
|
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-08-01 02:12:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-01 23:06:20 +00:00
|
|
|
Signals.addSignalMethods(SectionHeader.prototype);
|
|
|
|
|
2009-08-26 22:46:58 +00:00
|
|
|
function SearchSectionHeader(title, onClick) {
|
|
|
|
this._init(title, onClick);
|
|
|
|
}
|
|
|
|
|
|
|
|
SearchSectionHeader.prototype = {
|
|
|
|
_init : function(title, onClick) {
|
2009-11-11 19:13:38 +00:00
|
|
|
this.actor = new St.Button({ style_class: "dash-search-section-header",
|
|
|
|
x_fill: true,
|
|
|
|
y_fill: true });
|
|
|
|
let box = new St.BoxLayout();
|
|
|
|
this.actor.set_child(box);
|
|
|
|
let titleText = new St.Label({ style_class: "dash-search-section-title",
|
|
|
|
text: title });
|
|
|
|
this.countText = new St.Label({ style_class: "dash-search-section-count" });
|
|
|
|
|
|
|
|
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 22:46:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-09 23:48:54 +00: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-08-01 02:12:01 +00:00
|
|
|
}
|
|
|
|
|
2009-08-09 23:48:54 +00:00
|
|
|
Section.prototype = {
|
|
|
|
_init: function(titleString, suppressBrowse) {
|
2009-11-06 21:08:07 +00:00
|
|
|
this.actor = new St.BoxLayout({ style_class: 'dash-section',
|
|
|
|
vertical: true });
|
2009-08-09 23:48:54 +00:00
|
|
|
this.header = new SectionHeader(titleString, suppressBrowse);
|
2009-11-06 21:08:07 +00: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 23:48:54 +00: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-08-01 02:12:01 +00:00
|
|
|
|
2009-08-09 23:48:54 +00: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-08-01 02:12:01 +00:00
|
|
|
|
2009-08-09 23:48:54 +00: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-08-01 02:12:01 +00: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.
|
2009-10-22 17:33:09 +00:00
|
|
|
this.actor = new St.BoxLayout({ name: "dash",
|
|
|
|
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-08-01 02:12:01 +00:00
|
|
|
|
2009-08-09 23:48:54 +00:00
|
|
|
// Size for this one explicitly set from overlay.js
|
|
|
|
this.searchArea = new Big.Box({ y_align: Big.BoxAlignment.CENTER });
|
|
|
|
|
2009-11-06 22:32:23 +00:00
|
|
|
this.sectionArea = new St.BoxLayout({ name: "dashSections",
|
|
|
|
vertical: true });
|
2009-08-09 23:48:54 +00:00
|
|
|
|
2009-10-22 17:33:09 +00: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-08-01 02:12:01 +00:00
|
|
|
|
|
|
|
// The currently active popup display
|
|
|
|
this._activePane = null;
|
|
|
|
|
|
|
|
/***** Search *****/
|
|
|
|
|
|
|
|
this._searchActive = false;
|
2009-09-24 22:34:43 +00: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-08-01 02:12:01 +00:00
|
|
|
this._searchEntry = new SearchEntry();
|
2009-08-09 23:48:54 +00:00
|
|
|
this.searchArea.append(this._searchEntry.actor, Big.BoxPackFlags.EXPAND);
|
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-08-01 02:12:01 +00:00
|
|
|
|
2009-08-12 23:37:47 +00: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-08-01 02:12:01 +00:00
|
|
|
this._searchEntry.entry.connect('text-changed', Lang.bind(this, function (se, prop) {
|
2009-08-09 23:48:54 +00:00
|
|
|
let text = this._searchEntry.getText();
|
2009-08-12 21:07:00 +00:00
|
|
|
text = text.replace(/^\s+/g, "").replace(/\s+$/g, "")
|
2009-09-24 22:34:43 +00:00
|
|
|
let searchPreviouslyActive = this._searchActive;
|
2009-08-09 23:48:54 +00:00
|
|
|
this._searchActive = text != '';
|
2009-09-24 22:34:43 +00:00
|
|
|
this._searchPending = this._searchActive && !searchPreviouslyActive;
|
2009-08-21 22:21:35 +00:00
|
|
|
this._updateDashActors();
|
2009-08-12 21:07:00 +00:00
|
|
|
if (!this._searchActive) {
|
2009-08-13 17:11:21 +00:00
|
|
|
if (this._searchTimeoutId > 0) {
|
2009-08-12 23:37:47 +00:00
|
|
|
Mainloop.source_remove(this._searchTimeoutId);
|
2009-08-13 17:11:21 +00:00
|
|
|
this._searchTimeoutId = 0;
|
|
|
|
}
|
2009-08-12 21:07:00 +00:00
|
|
|
return;
|
|
|
|
}
|
2009-08-12 23:37:47 +00: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-08-01 02:12:01 +00:00
|
|
|
return;
|
2009-10-13 18:18:47 +00: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-08-01 02:12:01 +00:00
|
|
|
}));
|
|
|
|
this._searchEntry.entry.connect('activate', Lang.bind(this, function (se) {
|
2009-10-13 18:18:47 +00:00
|
|
|
if (this._searchTimeoutId > 0) {
|
|
|
|
Mainloop.source_remove(this._searchTimeoutId);
|
|
|
|
this._doSearch();
|
|
|
|
}
|
2009-09-11 20:42:54 +00:00
|
|
|
// Only one of the displays will have an item selected, so it's ok to
|
|
|
|
// call activateSelected() on all of them.
|
|
|
|
for (var i = 0; i < this._searchSections.length; i++) {
|
|
|
|
let section = this._searchSections[i];
|
|
|
|
section.resultArea.display.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-08-01 02:12:01 +00:00
|
|
|
return true;
|
|
|
|
}));
|
|
|
|
this._searchEntry.entry.connect('key-press-event', Lang.bind(this, function (se, e) {
|
2009-08-09 23:48:54 +00:00
|
|
|
let text = this._searchEntry.getText();
|
2009-09-08 20:58:57 +00:00
|
|
|
let symbol = e.get_key_symbol();
|
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-08-01 02:12:01 +00:00
|
|
|
if (symbol == Clutter.Escape) {
|
2009-08-26 22:46:58 +00:00
|
|
|
// Escape will keep clearing things back to the desktop.
|
|
|
|
// If we are showing a particular section of search, go back to all sections.
|
2009-09-11 20:42:54 +00:00
|
|
|
if (this._searchResultsSingleShownSection != null)
|
2009-08-26 22:46:58 +00:00
|
|
|
this._showAllSearchSections();
|
|
|
|
// If we have an active search, we remove it.
|
|
|
|
else if (this._searchActive)
|
2009-08-09 23:48:54 +00:00
|
|
|
this._searchEntry.reset();
|
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-08-01 02:12:01 +00:00
|
|
|
// Next, if we're in one of the "more" modes or showing the details pane, close them
|
|
|
|
else if (this._activePane != null)
|
|
|
|
this._activePane.close();
|
2009-08-11 11:46:10 +00:00
|
|
|
// Finally, just close the Overview entirely
|
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-08-01 02:12:01 +00:00
|
|
|
else
|
2009-08-11 11:46:10 +00:00
|
|
|
Main.overview.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-08-01 02:12:01 +00:00
|
|
|
return true;
|
|
|
|
} else if (symbol == Clutter.Up) {
|
|
|
|
if (!this._searchActive)
|
|
|
|
return true;
|
|
|
|
// selectUp and selectDown wrap around in their respective displays
|
|
|
|
// too, but there doesn't seem to be any flickering if we first select
|
|
|
|
// something in one display, but then unset the selection, and move
|
|
|
|
// it to the other display, so it's ok to do that.
|
2009-09-11 20:42:54 +00:00
|
|
|
for (var i = 0; i < this._searchSections.length; i++) {
|
|
|
|
let section = this._searchSections[i];
|
|
|
|
if (section.resultArea.display.hasSelected() && !section.resultArea.display.selectUp()) {
|
|
|
|
if (this._searchResultsSingleShownSection != section.type) {
|
|
|
|
// We need to move the selection to the next section above this section that has items,
|
|
|
|
// wrapping around at the bottom, if necessary.
|
|
|
|
let newSectionIndex = this._findAnotherSectionWithItems(i, -1);
|
|
|
|
if (newSectionIndex >= 0) {
|
|
|
|
this._searchSections[newSectionIndex].resultArea.display.selectLastItem();
|
|
|
|
section.resultArea.display.unsetSelected();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2009-09-01 20:24:47 +00: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-08-01 02:12:01 +00:00
|
|
|
return true;
|
|
|
|
} else if (symbol == Clutter.Down) {
|
|
|
|
if (!this._searchActive)
|
|
|
|
return true;
|
2009-09-11 20:42:54 +00:00
|
|
|
for (var i = 0; i < this._searchSections.length; i++) {
|
|
|
|
let section = this._searchSections[i];
|
|
|
|
if (section.resultArea.display.hasSelected() && !section.resultArea.display.selectDown()) {
|
|
|
|
if (this._searchResultsSingleShownSection != section.type) {
|
|
|
|
// We need to move the selection to the next section below this section that has items,
|
|
|
|
// wrapping around at the top, if necessary.
|
|
|
|
let newSectionIndex = this._findAnotherSectionWithItems(i, 1);
|
|
|
|
if (newSectionIndex >= 0) {
|
|
|
|
this._searchSections[newSectionIndex].resultArea.display.selectFirstItem();
|
|
|
|
section.resultArea.display.unsetSelected();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2009-09-01 20:24:47 +00: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-08-01 02:12:01 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}));
|
|
|
|
|
|
|
|
/***** Applications *****/
|
|
|
|
|
2009-08-21 22:21:35 +00:00
|
|
|
this._appsSection = new Section(_("APPLICATIONS"));
|
2009-08-09 23:48:54 +00:00
|
|
|
let appWell = new AppDisplay.AppWell();
|
2009-11-06 21:08:07 +00: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-08-01 02:12:01 +00:00
|
|
|
|
|
|
|
this._moreAppsPane = null;
|
2009-08-21 22:21:35 +00:00
|
|
|
this._appsSection.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-08-01 02:12:01 +00:00
|
|
|
if (this._moreAppsPane == null) {
|
2009-08-09 23:48:54 +00:00
|
|
|
this._moreAppsPane = new ResultPane(this);
|
2009-11-03 23:36:44 +00:00
|
|
|
this._moreAppsPane.packResults(APPS);
|
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-08-01 02:12:01 +00:00
|
|
|
this._addPane(this._moreAppsPane);
|
|
|
|
link.setPane(this._moreAppsPane);
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
|
2009-11-06 22:32:23 +00: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-08-01 02:12:01 +00:00
|
|
|
|
2009-08-06 13:06:33 +00:00
|
|
|
/***** Places *****/
|
|
|
|
|
2009-08-17 12:53:59 +00:00
|
|
|
/* Translators: This is in the sense of locations for documents,
|
|
|
|
network locations, etc. */
|
2009-08-21 22:21:35 +00:00
|
|
|
this._placesSection = new Section(_("PLACES"), true);
|
2009-11-01 02:25:28 +00:00
|
|
|
let placesDisplay = new PlaceDisplay.DashPlaceDisplay();
|
2009-11-06 21:08:07 +00:00
|
|
|
this._placesSection.content.add(placesDisplay.actor, { expand: true });
|
2009-11-06 22:32:23 +00:00
|
|
|
this.sectionArea.add(this._placesSection.actor);
|
2009-08-06 13:06:33 +00: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-08-01 02:12:01 +00:00
|
|
|
/***** Documents *****/
|
|
|
|
|
2009-08-21 22:21:35 +00:00
|
|
|
this._docsSection = new Section(_("RECENT DOCUMENTS"));
|
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-08-01 02:12:01 +00:00
|
|
|
|
2009-09-25 18:54:40 +00:00
|
|
|
this._docDisplay = new DocDisplay.DashDocDisplay();
|
2009-11-06 21:08:07 +00: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-08-01 02:12:01 +00:00
|
|
|
|
2009-08-09 23:48:54 +00:00
|
|
|
this._moreDocsPane = null;
|
2009-08-21 22:21:35 +00: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-08-01 02:12:01 +00:00
|
|
|
if (this._moreDocsPane == null) {
|
2009-08-09 23:48:54 +00:00
|
|
|
this._moreDocsPane = new ResultPane(this);
|
2009-11-03 23:36:44 +00:00
|
|
|
this._moreDocsPane.packResults(DOCS);
|
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-08-01 02:12:01 +00:00
|
|
|
this._addPane(this._moreDocsPane);
|
|
|
|
link.setPane(this._moreDocsPane);
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
|
2009-09-25 18:54:40 +00: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 22:32:23 +00:00
|
|
|
this.sectionArea.add(this._docsSection.actor, { expand: true });
|
2009-08-21 22:21:35 +00:00
|
|
|
|
|
|
|
/***** Search Results *****/
|
|
|
|
|
|
|
|
this._searchResultsSection = new Section(_("SEARCH RESULTS"), true);
|
|
|
|
|
2009-09-11 20:42:54 +00:00
|
|
|
this._searchResultsSingleShownSection = null;
|
|
|
|
|
2009-09-01 23:06:20 +00:00
|
|
|
this._searchResultsSection.header.connect('back-link-activated', Lang.bind(this, function () {
|
2009-09-11 20:42:54 +00:00
|
|
|
this._showAllSearchSections();
|
2009-09-01 23:06:20 +00:00
|
|
|
}));
|
|
|
|
|
2009-09-11 20:42:54 +00:00
|
|
|
this._searchSections = [
|
2009-09-11 21:48:02 +00:00
|
|
|
{ type: APPS,
|
2009-09-11 20:42:54 +00:00
|
|
|
title: _("APPLICATIONS"),
|
|
|
|
header: null,
|
2009-09-11 21:48:02 +00:00
|
|
|
resultArea: null
|
|
|
|
},
|
|
|
|
{ type: PREFS,
|
|
|
|
title: _("PREFERENCES"),
|
|
|
|
header: null,
|
|
|
|
resultArea: null
|
2009-09-11 20:42:54 +00:00
|
|
|
},
|
2009-09-11 21:48:02 +00:00
|
|
|
{ type: DOCS,
|
2009-09-11 20:42:54 +00:00
|
|
|
title: _("RECENT DOCUMENTS"),
|
|
|
|
header: null,
|
2009-09-11 21:48:02 +00:00
|
|
|
resultArea: null
|
2009-11-01 02:25:28 +00:00
|
|
|
},
|
|
|
|
{ type: PLACES,
|
|
|
|
title: _("PLACES"),
|
|
|
|
header: null,
|
|
|
|
resultArea: null
|
2009-09-11 20:42:54 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
for (var i = 0; i < this._searchSections.length; i++) {
|
|
|
|
let section = this._searchSections[i];
|
|
|
|
section.header = new SearchSectionHeader(section.title,
|
|
|
|
Lang.bind(this,
|
|
|
|
function () {
|
|
|
|
this._showSingleSearchSection(section.type);
|
|
|
|
}));
|
2009-11-06 21:08:07 +00:00
|
|
|
this._searchResultsSection.content.add(section.header.actor);
|
2009-11-03 23:36:44 +00:00
|
|
|
section.resultArea = new ResultArea(section.type, GenericDisplay.GenericDisplayFlags.DISABLE_VSCROLLING);
|
2009-11-06 21:08:07 +00:00
|
|
|
this._searchResultsSection.content.add(section.resultArea.actor, { expand: true });
|
2009-09-11 20:42:54 +00:00
|
|
|
createPaneForDetails(this, section.resultArea.display);
|
|
|
|
}
|
2009-08-21 22:21:35 +00:00
|
|
|
|
2009-11-06 22:32:23 +00:00
|
|
|
this.sectionArea.add(this._searchResultsSection.actor, { expand: true });
|
2009-08-21 22:21:35 +00:00
|
|
|
this._searchResultsSection.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-08-01 02:12:01 +00:00
|
|
|
},
|
|
|
|
|
2009-10-13 18:18:47 +00:00
|
|
|
_doSearch: function () {
|
|
|
|
this._searchTimeoutId = 0;
|
|
|
|
let text = this._searchEntry.getText();
|
|
|
|
text = text.replace(/^\s+/g, "").replace(/\s+$/g, "");
|
|
|
|
|
|
|
|
let selectionSet = false;
|
|
|
|
|
|
|
|
for (var i = 0; i < this._searchSections.length; i++) {
|
|
|
|
let section = this._searchSections[i];
|
|
|
|
section.resultArea.display.setSearch(text);
|
|
|
|
let itemCount = section.resultArea.display.getMatchedItemsCount();
|
|
|
|
let itemCountText = itemCount + "";
|
|
|
|
section.header.countText.text = itemCountText;
|
|
|
|
|
|
|
|
if (this._searchResultsSingleShownSection == section.type) {
|
|
|
|
this._searchResultsSection.header.setCountText(itemCountText);
|
|
|
|
if (itemCount == 0) {
|
|
|
|
section.resultArea.actor.hide();
|
|
|
|
} else {
|
|
|
|
section.resultArea.actor.show();
|
|
|
|
}
|
|
|
|
} else if (this._searchResultsSingleShownSection == null) {
|
|
|
|
// Don't show the section if it has no results
|
|
|
|
if (itemCount == 0) {
|
|
|
|
section.header.actor.hide();
|
|
|
|
section.resultArea.actor.hide();
|
|
|
|
} else {
|
|
|
|
section.header.actor.show();
|
|
|
|
section.resultArea.actor.show();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Refresh the selection when a new search is applied.
|
|
|
|
section.resultArea.display.unsetSelected();
|
|
|
|
if (!selectionSet && section.resultArea.display.hasItems() &&
|
|
|
|
(this._searchResultsSingleShownSection == null || this._searchResultsSingleShownSection == section.type)) {
|
|
|
|
section.resultArea.display.selectFirstItem();
|
|
|
|
selectionSet = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-03 23:36:44 +00:00
|
|
|
// Here work around a bug that I never quite tracked down
|
|
|
|
// the root cause of; it appeared that the search results
|
|
|
|
// section was getting a 0 height allocation.
|
|
|
|
this._searchResultsSection.content.queue_relayout();
|
|
|
|
|
2009-10-13 18:18:47 +00: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-08-01 02:12:01 +00:00
|
|
|
show: function() {
|
|
|
|
global.stage.set_key_focus(this._searchEntry.entry);
|
|
|
|
},
|
|
|
|
|
|
|
|
hide: function() {
|
2009-08-09 23:48:54 +00:00
|
|
|
this._firstSelectAfterOverlayShow = true;
|
|
|
|
this._searchEntry.reset();
|
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-08-01 02:12:01 +00:00
|
|
|
if (this._activePane != null)
|
|
|
|
this._activePane.close();
|
|
|
|
},
|
|
|
|
|
|
|
|
closePanes: function () {
|
|
|
|
if (this._activePane != null)
|
|
|
|
this._activePane.close();
|
|
|
|
},
|
|
|
|
|
|
|
|
_addPane: function(pane) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}));
|
2009-08-11 11:46:10 +00:00
|
|
|
Main.overview.addPane(pane);
|
2009-08-21 22:21:35 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
_updateDashActors: function() {
|
2009-09-24 22:34:43 +00:00
|
|
|
if (this._searchPending) {
|
|
|
|
this._searchResultsSection.actor.show();
|
2009-10-01 22:21:27 +00:00
|
|
|
// We initially hide all sections when we start a search. When the search timeout
|
|
|
|
// first runs, the sections that have matching results are shown. As the search
|
|
|
|
// is refined, only the sections that have matching results will be shown.
|
2009-09-24 22:34:43 +00:00
|
|
|
for (let i = 0; i < this._searchSections.length; i++) {
|
|
|
|
let section = this._searchSections[i];
|
|
|
|
section.header.actor.hide();
|
|
|
|
section.resultArea.actor.hide();
|
|
|
|
}
|
|
|
|
this._appsSection.actor.hide();
|
|
|
|
this._placesSection.actor.hide();
|
|
|
|
this._docsSection.actor.hide();
|
2009-10-01 22:21:27 +00:00
|
|
|
} else if (!this._searchActive) {
|
2009-08-26 22:46:58 +00:00
|
|
|
this._showAllSearchSections();
|
2009-08-21 22:21:35 +00:00
|
|
|
this._searchResultsSection.actor.hide();
|
|
|
|
this._appsSection.actor.show();
|
|
|
|
this._placesSection.actor.show();
|
|
|
|
this._docsSection.actor.show();
|
|
|
|
}
|
2009-08-26 22:46:58 +00:00
|
|
|
},
|
|
|
|
|
2009-09-11 20:42:54 +00:00
|
|
|
_showSingleSearchSection: function(type) {
|
|
|
|
// We currently don't allow going from showing one section to showing another section.
|
|
|
|
if (this._searchResultsSingleShownSection != null) {
|
|
|
|
throw new Error("We were already showing a single search section: '" + this._searchResultsSingleShownSection
|
|
|
|
+ "' when _showSingleSearchSection() was called for '" + type + "'");
|
2009-08-26 22:46:58 +00:00
|
|
|
}
|
2009-09-11 20:42:54 +00:00
|
|
|
for (var i = 0; i < this._searchSections.length; i++) {
|
|
|
|
let section = this._searchSections[i];
|
|
|
|
if (section.type == type) {
|
|
|
|
// This will be the only section shown.
|
|
|
|
section.resultArea.display.selectFirstItem();
|
2009-09-11 22:59:31 +00:00
|
|
|
let itemCount = section.resultArea.display.getMatchedItemsCount();
|
|
|
|
let itemCountText = itemCount + "";
|
2009-09-11 20:42:54 +00:00
|
|
|
section.header.actor.hide();
|
|
|
|
this._searchResultsSection.header.setTitle(section.title);
|
|
|
|
this._searchResultsSection.header.setBackLinkVisible(true);
|
2009-09-11 22:59:31 +00:00
|
|
|
this._searchResultsSection.header.setCountText(itemCountText);
|
2009-09-11 20:42:54 +00:00
|
|
|
} else {
|
|
|
|
// We need to hide this section.
|
|
|
|
section.header.actor.hide();
|
|
|
|
section.resultArea.actor.hide();
|
|
|
|
section.resultArea.display.unsetSelected();
|
|
|
|
}
|
2009-08-26 22:46:58 +00:00
|
|
|
}
|
2009-09-11 20:42:54 +00:00
|
|
|
this._searchResultsSingleShownSection = type;
|
2009-08-26 22:46:58 +00:00
|
|
|
},
|
|
|
|
|
2009-09-11 20:42:54 +00:00
|
|
|
_showAllSearchSections: function() {
|
|
|
|
if (this._searchResultsSingleShownSection != null) {
|
2009-09-11 22:59:31 +00:00
|
|
|
let selectionSet = false;
|
2009-09-11 20:42:54 +00:00
|
|
|
for (var i = 0; i < this._searchSections.length; i++) {
|
|
|
|
let section = this._searchSections[i];
|
|
|
|
if (section.type == this._searchResultsSingleShownSection) {
|
|
|
|
// This will no longer be the only section shown.
|
2009-09-11 22:59:31 +00:00
|
|
|
let itemCount = section.resultArea.display.getMatchedItemsCount();
|
|
|
|
if (itemCount != 0) {
|
|
|
|
section.header.actor.show();
|
|
|
|
section.resultArea.display.selectFirstItem();
|
|
|
|
selectionSet = true;
|
|
|
|
}
|
2009-09-11 20:42:54 +00:00
|
|
|
this._searchResultsSection.header.setTitle(_("SEARCH RESULTS"));
|
|
|
|
this._searchResultsSection.header.setBackLinkVisible(false);
|
|
|
|
this._searchResultsSection.header.setCountText("");
|
|
|
|
} else {
|
|
|
|
// We need to restore this section.
|
2009-09-11 22:59:31 +00:00
|
|
|
let itemCount = section.resultArea.display.getMatchedItemsCount();
|
|
|
|
if (itemCount != 0) {
|
|
|
|
section.header.actor.show();
|
|
|
|
section.resultArea.actor.show();
|
|
|
|
// This ensures that some other section will have the selection if the
|
|
|
|
// single section that was being displayed did not have any items.
|
|
|
|
if (!selectionSet) {
|
|
|
|
section.resultArea.display.selectFirstItem();
|
|
|
|
selectionSet = true;
|
|
|
|
}
|
|
|
|
}
|
2009-09-11 20:42:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
this._searchResultsSingleShownSection = null;
|
2009-08-26 22:46:58 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2009-09-11 20:42:54 +00:00
|
|
|
_findAnotherSectionWithItems: function(index, increment) {
|
|
|
|
let pos = _getIndexWrapped(index, increment, this._searchSections.length);
|
|
|
|
while (pos != index) {
|
|
|
|
if (this._searchSections[pos].resultArea.display.hasItems())
|
|
|
|
return pos;
|
|
|
|
pos = _getIndexWrapped(pos, increment, this._searchSections.length);
|
2009-09-01 23:06:20 +00:00
|
|
|
}
|
2009-09-11 20:42:54 +00:00
|
|
|
return -1;
|
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-08-01 02:12:01 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
Signals.addSignalMethods(Dash.prototype);
|