[dash] remove a bunch of dead code in the dash

The dash has lots of unused code left over from earlier designs. Kill
it.

https://bugzilla.gnome.org/show_bug.cgi?id=621582
This commit is contained in:
Dan Winship 2010-06-14 13:58:31 -04:00
parent bbfc980fe6
commit df13408973
6 changed files with 23 additions and 168 deletions

View File

@ -37,7 +37,6 @@ dist_theme_DATA = \
theme/scroll-button-up.png \ theme/scroll-button-up.png \
theme/scroll-hhandle.svg \ theme/scroll-hhandle.svg \
theme/scroll-vhandle.svg \ theme/scroll-vhandle.svg \
theme/section-back.svg \
theme/section-more.svg \ theme/section-more.svg \
theme/section-more-open.svg \ theme/section-more-open.svg \
theme/separator-white.png \ theme/separator-white.png \

View File

@ -408,20 +408,6 @@ StTooltip {
padding: 4px 0px; padding: 4px 0px;
} }
.section-header-back {
padding: 0px 4px 0px 0px;
border-right: 1px solid #262626;
}
.section-header-back-image {
background-image: url("section-back.svg");
width: 12px;
height: 16px;
}
.section-count {
}
.dash-section-content { .dash-section-content {
color: #ffffff; color: #ffffff;
spacing: 8px; spacing: 8px;

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Generator: Adobe Illustrator 13.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 14948) -->
<svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.0" id="Foreground" x="0px" y="0px" width="12" height="16" viewBox="0 0 12 16" enable-background="new 0 0 29 18" xml:space="preserve" sodipodi:version="0.32" inkscape:version="0.46+devel" sodipodi:docname="back.svg" inkscape:output_extension="org.inkscape.output.svg.inkscape"><metadata id="metadata16"><rdf:RDF><cc:Work rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title/></cc:Work></rdf:RDF></metadata><defs id="defs14"><inkscape:perspective sodipodi:type="inkscape:persp3d" inkscape:vp_x="0 : 9 : 1" inkscape:vp_y="0 : 1000 : 0" inkscape:vp_z="29 : 9 : 1" inkscape:persp3d-origin="14.5 : 6 : 1" id="perspective18"/></defs><sodipodi:namedview inkscape:window-height="728" inkscape:window-width="1103" inkscape:pageshadow="2" inkscape:pageopacity="1" guidetolerance="10.0" gridtolerance="10.0" objecttolerance="10.0" borderopacity="1.0" bordercolor="#666666" pagecolor="#000000" id="base" showgrid="true" inkscape:zoom="27.260185" inkscape:cx="12.592456" inkscape:cy="8.2696842" inkscape:window-x="145" inkscape:window-y="38" inkscape:current-layer="Foreground" inkscape:snap-global="true" showguides="false"><inkscape:grid type="xygrid" id="grid2391" empspacing="5" visible="true" enabled="true" snapvisiblegridlinesonly="true"/></sodipodi:namedview>
<path style="fill: rgb(255, 255, 255); fill-opacity: 1; stroke: none;" d="M 10,2 10,14 2,8 10,2 z" id="path43"/></svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

View File

@ -24,9 +24,6 @@ const Tweener = imports.ui.tweener;
// 25 search results (per result type) should be enough for everyone // 25 search results (per result type) should be enough for everyone
const MAX_RENDERED_SEARCH_RESULTS = 25; const MAX_RENDERED_SEARCH_RESULTS = 25;
const DOCS = 'docs';
const PLACES = 'places';
/* /*
* Returns the index in an array of a given length that is obtained * 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 * if the provided index is incremented by an increment and the array
@ -40,14 +37,6 @@ function _getIndexWrapped(index, increment, length) {
return (index + increment + length) % length; return (index + increment + length) % length;
} }
function _createDisplay(displayType, flags) {
if (displayType == DOCS)
return new DocDisplay.DocDisplay(flags);
else if (displayType == PLACES)
return new PlaceDisplay.PlaceDisplay(flags);
return null;
}
function Pane() { function Pane() {
this._init(); this._init();
} }
@ -64,15 +53,6 @@ Pane.prototype = {
return true; return true;
})); }));
let chromeTop = new St.BoxLayout();
let dummy = new St.Bin();
chromeTop.add(dummy, { expand: true });
this.actor.add(chromeTop);
this.content = new St.BoxLayout({ vertical: true });
this.actor.add(this.content, { expand: true });
// Hidden by default // Hidden by default
this.actor.hide(); this.actor.hide();
}, },
@ -107,7 +87,7 @@ Pane.prototype = {
}, },
destroyContent: function() { destroyContent: function() {
let children = this.content.get_children(); let children = this.actor.get_children();
for (let i = 0; i < children.length; i++) { for (let i = 0; i < children.length; i++) {
children[i].destroy(); children[i].destroy();
} }
@ -122,51 +102,22 @@ Pane.prototype = {
}; };
Signals.addSignalMethods(Pane.prototype); Signals.addSignalMethods(Pane.prototype);
function ResultArea(displayType, flags) { function ResultArea() {
this._init(displayType, flags); this._init();
} }
ResultArea.prototype = { ResultArea.prototype = {
_init : function(displayType, flags) { _init : function() {
this.actor = new St.BoxLayout({ vertical: true }); this.actor = new St.BoxLayout({ vertical: true });
this.resultsContainer = new St.BoxLayout({ style_class: 'dash-results-container' }); this.resultsContainer = new St.BoxLayout({ style_class: 'dash-results-container' });
this.actor.add(this.resultsContainer, { expand: true }); this.actor.add(this.resultsContainer, { expand: true });
this.display = _createDisplay(displayType, flags); this.display = new DocDisplay.DocDisplay();
this.resultsContainer.add(this.display.actor, { expand: true }); this.resultsContainer.add(this.display.actor, { expand: true });
this.display.load(); 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.
function createPaneForDetails(dash, display) {
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, St.Align.START);
}
if (index >= 0) {
detailPane.destroyContent();
let details = display.createDetailsForIndex(index);
detailPane.content.add(details, { expand: true });
detailPane.open();
} else {
detailPane.close();
}
}));
return null;
}
function ResultPane(dash) { function ResultPane(dash) {
this._init(dash); this._init(dash);
} }
@ -176,21 +127,12 @@ ResultPane.prototype = {
_init: function(dash) { _init: function(dash) {
Pane.prototype._init.call(this); Pane.prototype._init.call(this);
this._dash = dash;
},
// Create a display of displayType and pack it into this pane's let resultArea = new ResultArea();
// content area. Return the display. this.actor.add(resultArea.actor, { expand: true });
packResults: function(displayType) {
let resultArea = new ResultArea(displayType);
createPaneForDetails(this._dash, resultArea.display);
this.content.add(resultArea.actor, { expand: true });
this.connect('open-state-changed', Lang.bind(this, function(pane, isOpen) { this.connect('open-state-changed', Lang.bind(this, function(pane, isOpen) {
resultArea.display.resetState(); resultArea.display.resetState();
})); }));
return resultArea.display;
} }
}; };
@ -240,10 +182,6 @@ SearchEntry.prototype = {
} }
}, },
setPane: function (pane) {
this._pane = pane;
},
reset: function () { reset: function () {
let [x, y, mask] = global.get_pointer(); let [x, y, mask] = global.get_pointer();
let actor = global.stage.get_actor_at_pos (Clutter.PickMode.REACTIVE, let actor = global.stage.get_actor_at_pos (Clutter.PickMode.REACTIVE,
@ -660,18 +598,6 @@ MoreLink.prototype = {
Signals.addSignalMethods(MoreLink.prototype); Signals.addSignalMethods(MoreLink.prototype);
function BackLink() {
this._init();
}
BackLink.prototype = {
_init : function () {
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' }));
}
};
function SectionHeader(title, suppressBrowse) { function SectionHeader(title, suppressBrowse) {
this._init(title, suppressBrowse); this._init(title, suppressBrowse);
} }
@ -686,22 +612,11 @@ SectionHeader.prototype = {
this._innerBox = new St.BoxLayout({ style_class: 'section-header-inner' }); this._innerBox = new St.BoxLayout({ style_class: 'section-header-inner' });
this.actor.set_child(this._innerBox); this.actor.set_child(this._innerBox);
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');
}));
let textBox = new St.BoxLayout({ style_class: 'section-text-content' }); let textBox = new St.BoxLayout({ style_class: 'section-text-content' });
this.text = new St.Label({ style_class: 'section-title', this.text = new St.Label({ style_class: 'section-title',
text: title }); text: title });
textBox.add(this.text, { x_align: St.Align.START }); textBox.add(this.text, { x_align: St.Align.START });
this.countText = new St.Label({ style_class: 'section-count' });
textBox.add(this.countText, { expand: true, x_fill: false, x_align: St.Align.END });
this.countText.hide();
this._innerBox.add(textBox, { expand: true }); this._innerBox.add(textBox, { expand: true });
if (!suppressBrowse) { if (!suppressBrowse) {
@ -715,31 +630,11 @@ SectionHeader.prototype = {
this.moreLink.activate(); this.moreLink.activate();
}, },
setTitle : function(title) {
this.text.text = title;
},
setBackLinkVisible : function(visible) {
if (visible)
this.backLink.actor.show();
else
this.backLink.actor.hide();
},
setMoreLinkVisible : function(visible) { setMoreLinkVisible : function(visible) {
if (visible) if (visible)
this.moreLink.actor.show(); this.moreLink.actor.show();
else else
this.moreLink.actor.hide(); this.moreLink.actor.hide();
},
setCountText : function(countText) {
if (countText == '') {
this.countText.hide();
} else {
this.countText.show();
this.countText.text = countText;
}
} }
}; };
@ -904,7 +799,6 @@ Dash.prototype = {
this._docsSection.header.moreLink.connect('activated', Lang.bind(this, function (link) { this._docsSection.header.moreLink.connect('activated', Lang.bind(this, function (link) {
if (this._moreDocsPane == null) { if (this._moreDocsPane == null) {
this._moreDocsPane = new ResultPane(this); this._moreDocsPane = new ResultPane(this);
this._moreDocsPane.packResults(DOCS);
this._addPane(this._moreDocsPane, St.Align.END); this._addPane(this._moreDocsPane, St.Align.END);
link.setPane(this._moreDocsPane); link.setPane(this._moreDocsPane);
} }

View File

@ -115,15 +115,15 @@ DocDisplayItem.prototype = {
/* This class represents a display containing a collection of document items. /* This class represents a display containing a collection of document items.
* The documents are sorted by how recently they were last visited. * The documents are sorted by how recently they were last visited.
*/ */
function DocDisplay(flags) { function DocDisplay() {
this._init(flags); this._init();
} }
DocDisplay.prototype = { DocDisplay.prototype = {
__proto__: GenericDisplay.GenericDisplay.prototype, __proto__: GenericDisplay.GenericDisplay.prototype,
_init : function(flags) { _init : function() {
GenericDisplay.GenericDisplay.prototype._init.call(this, flags); GenericDisplay.GenericDisplay.prototype._init.call(this);
// We keep a single timeout callback for updating last visited times // We keep a single timeout callback for updating last visited times
// for all the items in the display. This avoids creating individual // for all the items in the display. This avoids creating individual
// callbacks for each item in the display. So proper time updates // callbacks for each item in the display. So proper time updates

View File

@ -229,27 +229,18 @@ GenericDisplayItem.prototype = {
Signals.addSignalMethods(GenericDisplayItem.prototype); Signals.addSignalMethods(GenericDisplayItem.prototype);
const GenericDisplayFlags = {
DISABLE_VSCROLLING: 1 << 0
};
/* This is a virtual class that represents a display containing a collection of items /* This is a virtual class that represents a display containing a collection of items
* that can be filtered with a search string. * that can be filtered with a search string.
*/ */
function GenericDisplay(flags) { function GenericDisplay() {
this._init(flags); this._init();
} }
GenericDisplay.prototype = { GenericDisplay.prototype = {
_init : function(flags) { _init : function() {
let disableVScrolling = (flags & GenericDisplayFlags.DISABLE_VSCROLLING) != 0;
this._search = ''; this._search = '';
this._expanded = false; this._expanded = false;
if (disableVScrolling) {
this.actor = this._list = new Shell.OverflowList({ spacing: 6,
item_height: 50 });
} else {
this.actor = new St.ScrollView({ x_fill: true, this.actor = new St.ScrollView({ x_fill: true,
y_fill: false, y_fill: false,
vshadows: true }); vshadows: true });
@ -257,7 +248,6 @@ GenericDisplay.prototype = {
vertical: true }); vertical: true });
this.actor.add_actor(this._list); this.actor.add_actor(this._list);
this.actor.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC); this.actor.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
}
this._pendingRedisplay = RedisplayFlags.NONE; this._pendingRedisplay = RedisplayFlags.NONE;
this.actor.connect('notify::mapped', Lang.bind(this, this._onMappedNotify)); this.actor.connect('notify::mapped', Lang.bind(this, this._onMappedNotify));
@ -381,7 +371,6 @@ GenericDisplay.prototype = {
resetState: function() { resetState: function() {
this._filterReset(); this._filterReset();
this._openDetailIndex = -1; this._openDetailIndex = -1;
if (!(this.actor instanceof Shell.OverflowList))
this.actor.get_vscroll_bar().get_adjustment().value = 0; this.actor.get_vscroll_bar().get_adjustment().value = 0;
}, },
@ -661,11 +650,7 @@ GenericDisplay.prototype = {
// Returns a display item based on its index in the ordering of the // Returns a display item based on its index in the ordering of the
// display children. // display children.
_findDisplayedByIndex: function(index) { _findDisplayedByIndex: function(index) {
let actor; let actor = this._list.get_children()[index];
if (this.actor instanceof Shell.OverflowList)
actor = this.actor.get_displayed_actor(index);
else
actor = this._list.get_children()[index];
return this._findDisplayedByActor(actor); return this._findDisplayedByActor(actor);
}, },
@ -700,8 +685,6 @@ GenericDisplay.prototype = {
}, },
_getVisibleCount: function() { _getVisibleCount: function() {
if (this.actor instanceof Shell.OverflowList)
return this._list.displayed_count;
return this._list.get_n_children(); return this._list.get_n_children();
}, },