appIcon: Always pass parent view

We will soon need to know which view this icon belongs to,
so add an extra parameter to the constructor to store the
parent view.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/603
This commit is contained in:
Georges Basile Stavracas Neto 2019-06-28 21:11:10 -03:00
parent bb9f05843f
commit 6da23c8d4d
No known key found for this signature in database
GPG Key ID: 886C17EE170D1385
2 changed files with 11 additions and 6 deletions

View File

@ -413,7 +413,7 @@ var AllView = class AllView extends BaseAppView {
apps.forEach(appId => { apps.forEach(appId => {
let app = appSys.lookup_app(appId); let app = appSys.lookup_app(appId);
let icon = new AppIcon(app, let icon = new AppIcon(app, this,
{ isDraggable: favoritesWritable }); { isDraggable: favoritesWritable });
newApps.push(icon); newApps.push(icon);
}); });
@ -744,7 +744,7 @@ var FrequentView = class FrequentView extends BaseAppView {
for (let i = 0; i < mostUsed.length; i++) { for (let i = 0; i < mostUsed.length; i++) {
if (!mostUsed[i].get_app_info().should_show()) if (!mostUsed[i].get_app_info().should_show())
continue; continue;
let appIcon = new AppIcon(mostUsed[i], let appIcon = new AppIcon(mostUsed[i], this,
{ isDraggable: favoritesWritable }); { isDraggable: favoritesWritable });
apps.push(appIcon); apps.push(appIcon);
} }
@ -1035,7 +1035,7 @@ var AppSearchProvider = class AppSearchProvider {
createResultObject(resultMeta) { createResultObject(resultMeta) {
if (resultMeta.id.endsWith('.desktop')) if (resultMeta.id.endsWith('.desktop'))
return new AppIcon(this._appSys.lookup_app(resultMeta['id'])); return new AppIcon(this._appSys.lookup_app(resultMeta['id']), null);
else else
return new SystemActionIcon(this, resultMeta); return new SystemActionIcon(this, resultMeta);
} }
@ -1173,7 +1173,7 @@ var FolderView = class FolderView extends BaseAppView {
if (apps.some(appIcon => appIcon.id == appId)) if (apps.some(appIcon => appIcon.id == appId))
return; return;
let icon = new AppIcon(app); let icon = new AppIcon(app, this);
apps.push(icon); apps.push(icon);
}; };
@ -1560,10 +1560,11 @@ var AppFolderPopup = class AppFolderPopup {
Signals.addSignalMethods(AppFolderPopup.prototype); Signals.addSignalMethods(AppFolderPopup.prototype);
var AppIcon = class AppIcon { var AppIcon = class AppIcon {
constructor(app, iconParams = {}) { constructor(app, view, iconParams = {}) {
this.app = app; this.app = app;
this.id = app.get_id(); this.id = app.get_id();
this.name = app.get_name(); this.name = app.get_name();
this._view = view;
this.actor = new St.Button({ style_class: 'app-well-app', this.actor = new St.Button({ style_class: 'app-well-app',
reactive: true, reactive: true,
@ -1802,6 +1803,10 @@ var AppIcon = class AppIcon {
shouldShowTooltip() { shouldShowTooltip() {
return this.actor.hover && (!this._menu || !this._menu.isOpen); return this.actor.hover && (!this._menu || !this._menu.isOpen);
} }
get view() {
return this._view;
}
}; };
Signals.addSignalMethods(AppIcon.prototype); Signals.addSignalMethods(AppIcon.prototype);

View File

@ -475,7 +475,7 @@ var Dash = class Dash {
} }
_createAppItem(app) { _createAppItem(app) {
let appIcon = new AppDisplay.AppIcon(app, let appIcon = new AppDisplay.AppIcon(app, null,
{ setSizeManually: true, { setSizeManually: true,
showLabel: false }); showLabel: false });
if (appIcon._draggable) { if (appIcon._draggable) {