appDisplay: Merge AllAppDisplay and ViewByCategories

With categories removed, the separation between AllAppDisplay and
ViewByCategories no longer makes sense. Also use this opportunity
to rename the outdated AllAppDisplay to AppDisplay; it will
eventually be used to manage different views.

https://bugzilla.gnome.org/show_bug.cgi?id=694192
This commit is contained in:
Florian Müllner 2013-01-30 23:58:42 +01:00
parent 2658754295
commit c9e2f16404
3 changed files with 18 additions and 33 deletions

View File

@ -847,12 +847,12 @@ StScrollBar StButton#vhandle:active {
icon-size: 96px;
}
.all-app {
.app-display {
padding: 0px 16px 32px 32px;
spacing: 20px;
}
.all-app:rtl {
.app-display:rtl {
padding-left: 16px;
padding-right: 32px;
}

View File

@ -108,22 +108,30 @@ const AlphabeticalView = new Lang.Class({
}
});
const ViewByCategories = new Lang.Class({
Name: 'ViewByCategories',
const AppDisplay = new Lang.Class({
Name: 'AppDisplay',
_init: function() {
this._appSystem = Shell.AppSystem.get_default();
this.actor = new St.BoxLayout({ style_class: 'all-app' });
this.actor._delegate = this;
this._appSystem.connect('installed-changed', Lang.bind(this, function() {
Main.queueDeferredWork(this._workId);
}));
let box = new St.BoxLayout();
this.actor = new St.Bin({ child: box,
style_class: 'app-display',
x_fill: true, y_fill: true });
this._view = new AlphabeticalView();
this.actor.add(this._view.actor, { expand: true, x_fill: true, y_fill: true });
box.add(this._view.actor);
// We need a dummy actor to catch the keyboard focus if the
// user Ctrl-Alt-Tabs here before the deferred work creates
// our real contents
this._focusDummy = new St.Bin({ can_focus: true });
this.actor.add(this._focusDummy);
box.add(this._focusDummy);
this._workId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplay));
},
// Recursively load a GMenuTreeDirectory; we could put this in ShellAppSystem too
@ -148,7 +156,7 @@ const ViewByCategories = new Lang.Class({
this._view.removeAll();
},
refresh: function() {
_redisplay: function() {
this._removeAll();
var tree = this._appSystem.get_tree();
@ -176,29 +184,6 @@ const ViewByCategories = new Lang.Class({
}
});
/* This class represents a display containing a collection of application items.
* The applications are sorted based on their name.
*/
const AllAppDisplay = new Lang.Class({
Name: 'AllAppDisplay',
_init: function() {
this._appSystem = Shell.AppSystem.get_default();
this._appSystem.connect('installed-changed', Lang.bind(this, function() {
Main.queueDeferredWork(this._workId);
}));
this._appView = new ViewByCategories();
this.actor = new St.Bin({ child: this._appView.actor, x_fill: true, y_fill: true });
this._workId = Main.initializeDeferredWork(this.actor, Lang.bind(this, this._redisplay));
},
_redisplay: function() {
this._appView.refresh();
}
});
const AppSearchProvider = new Lang.Class({
Name: 'AppSearchProvider',

View File

@ -96,7 +96,7 @@ const ViewSelector = new Lang.Class({
this._workspacesPage = this._addPage(this._workspacesDisplay.actor,
_("Windows"), 'emblem-documents-symbolic');
this._appDisplay = new AppDisplay.AllAppDisplay();
this._appDisplay = new AppDisplay.AppDisplay();
this._appsPage = this._addPage(this._appDisplay.actor,
_("Applications"), 'view-grid-symbolic');