[gnome-shell] [dash] remove a bunch of dead code in the dash
- From: Dan Winship <danw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] [dash] remove a bunch of dead code in the dash
- Date: Tue, 15 Jun 2010 16:04:03 +0000 (UTC)
commit df13408973ce5d911da698a590f2868b3b34f102
Author: Dan Winship <danw gnome org>
Date: Mon Jun 14 13:58:31 2010 -0400
[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
data/Makefile.am | 1 -
data/theme/gnome-shell.css | 14 -----
data/theme/section-back.svg | 7 ---
js/ui/dash.js | 120 +++----------------------------------------
js/ui/docDisplay.js | 8 ++--
js/ui/genericDisplay.js | 41 ++++----------
6 files changed, 23 insertions(+), 168 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index f035f95..f0cc6d4 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -37,7 +37,6 @@ dist_theme_DATA = \
theme/scroll-button-up.png \
theme/scroll-hhandle.svg \
theme/scroll-vhandle.svg \
- theme/section-back.svg \
theme/section-more.svg \
theme/section-more-open.svg \
theme/separator-white.png \
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 8e0ef19..67e653e 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -408,20 +408,6 @@ StTooltip {
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 {
color: #ffffff;
spacing: 8px;
diff --git a/js/ui/dash.js b/js/ui/dash.js
index a26e6cf..02ff381 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -24,9 +24,6 @@ const Tweener = imports.ui.tweener;
// 25 search results (per result type) should be enough for everyone
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
* 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;
}
-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() {
this._init();
}
@@ -64,15 +53,6 @@ Pane.prototype = {
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
this.actor.hide();
},
@@ -107,7 +87,7 @@ Pane.prototype = {
},
destroyContent: function() {
- let children = this.content.get_children();
+ let children = this.actor.get_children();
for (let i = 0; i < children.length; i++) {
children[i].destroy();
}
@@ -122,51 +102,22 @@ Pane.prototype = {
};
Signals.addSignalMethods(Pane.prototype);
-function ResultArea(displayType, flags) {
- this._init(displayType, flags);
+function ResultArea() {
+ this._init();
}
ResultArea.prototype = {
- _init : function(displayType, flags) {
+ _init : function() {
this.actor = new St.BoxLayout({ vertical: true });
this.resultsContainer = new St.BoxLayout({ style_class: 'dash-results-container' });
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.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) {
this._init(dash);
}
@@ -176,21 +127,12 @@ ResultPane.prototype = {
_init: function(dash) {
Pane.prototype._init.call(this);
- this._dash = dash;
- },
-
- // Create a display of displayType and pack it into this pane's
- // content area. Return the display.
- packResults: function(displayType) {
- let resultArea = new ResultArea(displayType);
-
- createPaneForDetails(this._dash, resultArea.display);
- this.content.add(resultArea.actor, { expand: true });
+ let resultArea = new ResultArea();
+ this.actor.add(resultArea.actor, { expand: true });
this.connect('open-state-changed', Lang.bind(this, function(pane, isOpen) {
resultArea.display.resetState();
}));
- return resultArea.display;
}
};
@@ -240,10 +182,6 @@ SearchEntry.prototype = {
}
},
- setPane: function (pane) {
- this._pane = pane;
- },
-
reset: function () {
let [x, y, mask] = global.get_pointer();
let actor = global.stage.get_actor_at_pos (Clutter.PickMode.REACTIVE,
@@ -660,18 +598,6 @@ 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) {
this._init(title, suppressBrowse);
}
@@ -686,22 +612,11 @@ SectionHeader.prototype = {
this._innerBox = new St.BoxLayout({ style_class: 'section-header-inner' });
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' });
this.text = new St.Label({ style_class: 'section-title',
text: title });
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 });
if (!suppressBrowse) {
@@ -715,31 +630,11 @@ SectionHeader.prototype = {
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) {
if (visible)
this.moreLink.actor.show();
else
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) {
if (this._moreDocsPane == null) {
this._moreDocsPane = new ResultPane(this);
- this._moreDocsPane.packResults(DOCS);
this._addPane(this._moreDocsPane, St.Align.END);
link.setPane(this._moreDocsPane);
}
diff --git a/js/ui/docDisplay.js b/js/ui/docDisplay.js
index 3925c27..f9abfc8 100644
--- a/js/ui/docDisplay.js
+++ b/js/ui/docDisplay.js
@@ -115,15 +115,15 @@ DocDisplayItem.prototype = {
/* This class represents a display containing a collection of document items.
* The documents are sorted by how recently they were last visited.
*/
-function DocDisplay(flags) {
- this._init(flags);
+function DocDisplay() {
+ this._init();
}
DocDisplay.prototype = {
__proto__: GenericDisplay.GenericDisplay.prototype,
- _init : function(flags) {
- GenericDisplay.GenericDisplay.prototype._init.call(this, flags);
+ _init : function() {
+ GenericDisplay.GenericDisplay.prototype._init.call(this);
// We keep a single timeout callback for updating last visited times
// for all the items in the display. This avoids creating individual
// callbacks for each item in the display. So proper time updates
diff --git a/js/ui/genericDisplay.js b/js/ui/genericDisplay.js
index 46f1c96..1d86399 100644
--- a/js/ui/genericDisplay.js
+++ b/js/ui/genericDisplay.js
@@ -229,35 +229,25 @@ 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
* that can be filtered with a search string.
*/
-function GenericDisplay(flags) {
- this._init(flags);
+function GenericDisplay() {
+ this._init();
}
GenericDisplay.prototype = {
- _init : function(flags) {
- let disableVScrolling = (flags & GenericDisplayFlags.DISABLE_VSCROLLING) != 0;
+ _init : function() {
this._search = '';
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,
- y_fill: false,
- vshadows: true });
- this._list = new St.BoxLayout({ style_class: 'generic-display-container',
- vertical: true });
- this.actor.add_actor(this._list);
- this.actor.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
- }
+ this.actor = new St.ScrollView({ x_fill: true,
+ y_fill: false,
+ vshadows: true });
+ this._list = new St.BoxLayout({ style_class: 'generic-display-container',
+ vertical: true });
+ this.actor.add_actor(this._list);
+ this.actor.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC);
this._pendingRedisplay = RedisplayFlags.NONE;
this.actor.connect('notify::mapped', Lang.bind(this, this._onMappedNotify));
@@ -381,8 +371,7 @@ GenericDisplay.prototype = {
resetState: function() {
this._filterReset();
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;
},
// Returns an actor which acts as a sidebar; this is used for
@@ -661,11 +650,7 @@ GenericDisplay.prototype = {
// Returns a display item based on its index in the ordering of the
// display children.
_findDisplayedByIndex: function(index) {
- let actor;
- if (this.actor instanceof Shell.OverflowList)
- actor = this.actor.get_displayed_actor(index);
- else
- actor = this._list.get_children()[index];
+ let actor = this._list.get_children()[index];
return this._findDisplayedByActor(actor);
},
@@ -700,8 +685,6 @@ GenericDisplay.prototype = {
},
_getVisibleCount: function() {
- if (this.actor instanceof Shell.OverflowList)
- return this._list.displayed_count;
return this._list.get_n_children();
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]