Fix regressions in the item displays
Fix displaying documents in the document browse and refreshing the selection when the results have changed. Make sure we are passing the appropriate flag to _redisplay() in GenericDisplay. Make sure we set this._appsStale to true if there was a change in the applications set. Don't call _refreshCache() from the AppDisplay constructor. Don't short-circuit the call to _refreshCache() from _redisplay() on initial load. Rename _redisplayFull() to recreateDisplayItems() and remove adding an actor to the actual result list in _addDisplayItem() because we redo adding the actors to the list in _redisplayReordering() anyway to ensure that we add them in the right order. Based on a patch from Colin Walters.
This commit is contained in:
parent
956f89f377
commit
eb8176deeb
@ -186,23 +186,21 @@ AppDisplay.prototype = {
|
|||||||
this._appsStale = true;
|
this._appsStale = true;
|
||||||
this._appSystem.connect('installed-changed', Lang.bind(this, function(appSys) {
|
this._appSystem.connect('installed-changed', Lang.bind(this, function(appSys) {
|
||||||
this._appsStale = true;
|
this._appsStale = true;
|
||||||
this._redisplay(0);
|
this._redisplay(GenericDisplay.RedisplayFlags.NONE);
|
||||||
this._redisplayMenus();
|
|
||||||
}));
|
}));
|
||||||
this._appSystem.connect('favorites-changed', Lang.bind(this, function(appSys) {
|
this._appSystem.connect('favorites-changed', Lang.bind(this, function(appSys) {
|
||||||
this._redisplay(0);
|
this._appsStale = true;
|
||||||
|
this._redisplay(GenericDisplay.RedisplayFlags.NONE);
|
||||||
}));
|
}));
|
||||||
this._appMonitor.connect('app-added', Lang.bind(this, function(monitor) {
|
this._appMonitor.connect('app-added', Lang.bind(this, function(monitor) {
|
||||||
this._redisplay(0);
|
this._appsStale = true;
|
||||||
|
this._redisplay(GenericDisplay.RedisplayFlags.NONE);
|
||||||
}));
|
}));
|
||||||
this._appMonitor.connect('app-removed', Lang.bind(this, function(monitor) {
|
this._appMonitor.connect('app-removed', Lang.bind(this, function(monitor) {
|
||||||
this._redisplay(0);
|
this._appsStale = true;
|
||||||
|
this._redisplay(GenericDisplay.RedisplayFlags.NONE);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// Load the apps now so it doesn't slow down the first
|
|
||||||
// transition into the Overview
|
|
||||||
this._refreshCache();
|
|
||||||
|
|
||||||
this._focusInMenus = true;
|
this._focusInMenus = true;
|
||||||
this._activeMenuIndex = -1;
|
this._activeMenuIndex = -1;
|
||||||
this._activeMenu = null;
|
this._activeMenu = null;
|
||||||
@ -210,7 +208,6 @@ AppDisplay.prototype = {
|
|||||||
this._menuDisplay = new Big.Box({ orientation: Big.BoxOrientation.VERTICAL,
|
this._menuDisplay = new Big.Box({ orientation: Big.BoxOrientation.VERTICAL,
|
||||||
spacing: MENU_SPACING
|
spacing: MENU_SPACING
|
||||||
});
|
});
|
||||||
this._redisplayMenus();
|
|
||||||
|
|
||||||
this.connect('expanded', Lang.bind(this, function (self) {
|
this.connect('expanded', Lang.bind(this, function (self) {
|
||||||
this._filterReset();
|
this._filterReset();
|
||||||
@ -303,7 +300,7 @@ AppDisplay.prototype = {
|
|||||||
this._activeMenuApps = this._appSystem.get_applications_for_menu(id);
|
this._activeMenuApps = this._appSystem.get_applications_for_menu(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._redisplay(true);
|
this._redisplay(GenericDisplay.RedisplayFlags.FULL);
|
||||||
}));
|
}));
|
||||||
this._menuDisplay.append(display.actor, 0);
|
this._menuDisplay.append(display.actor, 0);
|
||||||
},
|
},
|
||||||
@ -361,6 +358,7 @@ AppDisplay.prototype = {
|
|||||||
this._addApp(app);
|
this._addApp(app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this._redisplayMenus();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._appsStale = false;
|
this._appsStale = false;
|
||||||
|
@ -136,7 +136,7 @@ DocDisplay.prototype = {
|
|||||||
// but redisplaying right away is cool when we use Zephyr.
|
// but redisplaying right away is cool when we use Zephyr.
|
||||||
// Also, we might be displaying remote documents, like Google Docs, in the future
|
// Also, we might be displaying remote documents, like Google Docs, in the future
|
||||||
// which might be edited by someone else.
|
// which might be edited by someone else.
|
||||||
this._redisplay(false);
|
this._redisplay(GenericDisplay.RedisplayFlags.NONE);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.connect('destroy', Lang.bind(this, function (o) {
|
this.connect('destroy', Lang.bind(this, function (o) {
|
||||||
|
@ -486,15 +486,16 @@ GenericDisplay.prototype = {
|
|||||||
|
|
||||||
//// Protected methods ////
|
//// Protected methods ////
|
||||||
|
|
||||||
_redisplayFull: function() {
|
_recreateDisplayItems: function() {
|
||||||
this._removeAllDisplayItems();
|
this._removeAllDisplayItems();
|
||||||
|
this._setDefaultList();
|
||||||
for (let itemId in this._allItems) {
|
for (let itemId in this._allItems) {
|
||||||
this._addDisplayItem(itemId);
|
this._addDisplayItem(itemId);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Creates a display item based on the information associated with itemId
|
// Creates a display item based on the information associated with itemId
|
||||||
// and adds it to the displayed items.
|
// and adds it to the list of displayed items, but does not yet display it.
|
||||||
_addDisplayItem : function(itemId) {
|
_addDisplayItem : function(itemId) {
|
||||||
if (this._displayedItems.hasOwnProperty(itemId)) {
|
if (this._displayedItems.hasOwnProperty(itemId)) {
|
||||||
log("Tried adding a display item for " + itemId + ", but an item with this item id is already among displayed items.");
|
log("Tried adding a display item for " + itemId + ", but an item with this item id is already among displayed items.");
|
||||||
@ -525,7 +526,6 @@ GenericDisplay.prototype = {
|
|||||||
this.emit('show-details', index);
|
this.emit('show-details', index);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
this._list.add_actor(displayItem.actor);
|
|
||||||
this._displayedItems[itemId] = displayItem;
|
this._displayedItems[itemId] = displayItem;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -635,6 +635,7 @@ GenericDisplay.prototype = {
|
|||||||
* their own while the user was browsing through the result pages.
|
* their own while the user was browsing through the result pages.
|
||||||
* SUBSEARCH - Indicates that the current _search is a superstring of the previous
|
* SUBSEARCH - Indicates that the current _search is a superstring of the previous
|
||||||
* one, which implies we only need to re-search through previous results.
|
* one, which implies we only need to re-search through previous results.
|
||||||
|
* FULL - Indicates that we need refresh all displayed items.
|
||||||
*/
|
*/
|
||||||
_redisplay: function(flags) {
|
_redisplay: function(flags) {
|
||||||
let resetPage = (flags & RedisplayFlags.RESET_CONTROLS) > 0;
|
let resetPage = (flags & RedisplayFlags.RESET_CONTROLS) > 0;
|
||||||
@ -642,13 +643,20 @@ GenericDisplay.prototype = {
|
|||||||
let fullReload = (flags & RedisplayFlags.FULL) > 0;
|
let fullReload = (flags & RedisplayFlags.FULL) > 0;
|
||||||
|
|
||||||
let hadSelected = this.hasSelected();
|
let hadSelected = this.hasSelected();
|
||||||
|
this.unsetSelected();
|
||||||
|
|
||||||
if (!this._initialLoadComplete || !this._refreshCache())
|
if (!this._initialLoadComplete)
|
||||||
fullReload = true;
|
fullReload = true;
|
||||||
|
|
||||||
|
if (!this._refreshCache())
|
||||||
|
fullReload = true;
|
||||||
|
|
||||||
if (fullReload) {
|
if (fullReload) {
|
||||||
|
this._recreateDisplayItems();
|
||||||
this._initialLoadComplete = true;
|
this._initialLoadComplete = true;
|
||||||
this._redisplayFull();
|
}
|
||||||
} if (isSubSearch) {
|
|
||||||
|
if (isSubSearch) {
|
||||||
this._redisplaySubSearch();
|
this._redisplaySubSearch();
|
||||||
} else {
|
} else {
|
||||||
this._redisplayReordering();
|
this._redisplayReordering();
|
||||||
|
Loading…
Reference in New Issue
Block a user