[gnome-shell/eos3.8: 110/255] appDisplay: Add the App Center icon to the grid
- From: Matthew Leeds <mwleeds src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/eos3.8: 110/255] appDisplay: Add the App Center icon to the grid
- Date: Wed, 10 Jun 2020 19:07:13 +0000 (UTC)
commit eca7e36138ffc2b2f001ba713147775e665bead8
Author: Joaquim Rocha <jrocha endlessm com>
Date: Wed Jun 21 17:38:11 2017 +0200
appDisplay: Add the App Center icon to the grid
The icon is added at the end of the grid and, unlike other icons, is
non-draggable, non-editable, and has no popup menu. It will be only
added if enabled through a GSettings key 'enable-app-center', so that
it can be configured without it for special environments like demos
or eosinstaller images.
* 2020-03-20:
+ Remove GSetting to hide app center
+ Squash with c9e3e4ba1
+ Squash with 6a3abd33a
https://phabricator.endlessm.com/T17661
https://phabricator.endlessm.com/T17787
https://phabricator.endlessm.com/T17875
https://phabricator.endlessm.com/T18933
data/gnome-shell-theme.gresource.xml | 2 +
data/theme/trash-icon-empty.png | Bin 0 -> 6370 bytes
data/theme/trash-icon-full.png | Bin 0 -> 6420 bytes
js/ui/appDisplay.js | 95 +++++++++++++++++++++++++++++++++++
4 files changed, 97 insertions(+)
---
diff --git a/data/gnome-shell-theme.gresource.xml b/data/gnome-shell-theme.gresource.xml
index 63673241a1..907d05dc25 100644
--- a/data/gnome-shell-theme.gresource.xml
+++ b/data/gnome-shell-theme.gresource.xml
@@ -50,5 +50,7 @@
<file>mini-icon-active-indicator.png</file>
<file>process-working-dark.svg</file>
<file>system-logout.png</file>
+ <file>trash-icon-empty.png</file>
+ <file>trash-icon-full.png</file>
</gresource>
</gresources>
diff --git a/data/theme/trash-icon-empty.png b/data/theme/trash-icon-empty.png
new file mode 100644
index 0000000000..cb8c746ea5
Binary files /dev/null and b/data/theme/trash-icon-empty.png differ
diff --git a/data/theme/trash-icon-full.png b/data/theme/trash-icon-full.png
new file mode 100644
index 0000000000..35d56ce356
Binary files /dev/null and b/data/theme/trash-icon-full.png differ
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 9bbe8cfc87..f89449d584 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -484,6 +484,7 @@ class AppDisplay extends BaseAppView {
this.bind_property('mapped', this._bgAction,
'enabled', GObject.BindingFlags.SYNC_CREATE);
+ this._appCenterIcon = null;
this._currentDialog = null;
this._displayingDialog = false;
this._currentDialogDestroyId = 0;
@@ -619,9 +620,25 @@ class AppDisplay extends BaseAppView {
appIcons.push(icon);
});
+ // Add the App Center icon if it is enabled (and installed)
+ this._maybeAddAppCenterIcon(appIcons);
+
return appIcons;
}
+ _maybeAddAppCenterIcon(apps) {
+ let appSys = Shell.AppSystem.get_default();
+ if (!appSys.lookup_app(EOS_APP_CENTER_ID)) {
+ log('App center %s is not installed'.format(EOS_APP_CENTER_ID));
+ return;
+ }
+
+ if (!this._appCenterIcon)
+ this._appCenterIcon = new AppCenterIcon();
+
+ apps.push(this._appCenterIcon);
+ }
+
// Overridden from BaseAppView
animate(animationDirection, onComplete) {
this._scrollView.reactive = false;
@@ -2438,3 +2455,81 @@ class SystemActionIcon extends Search.GridSearchResult {
Main.overview.viewSelector.show(2);
}
});
+
+var AppCenterIcon = GObject.registerClass(
+class AppCenterIcon extends AppIcon {
+ _init() {
+ let viewIconParams = {
+ isDraggable: false,
+ showMenu: false,
+ };
+
+ let iconParams = {
+ createIcon: this._createIcon.bind(this),
+ };
+
+ let appSys = Shell.AppSystem.get_default();
+ let app = appSys.lookup_app(EOS_APP_CENTER_ID);
+
+ super._init(app, viewIconParams, iconParams);
+
+ this._id = EOS_APP_CENTER_ID;
+ this._name = this.app.get_generic_name();
+ this.icon.label.text = this.name;
+ }
+
+ _onDragBegin() {
+ super._onDragBegin();
+
+ this.icon.label.text = _("Remove");
+ this.icon.update();
+ }
+
+ _onDragEnd() {
+ super._onDragEnd();
+
+ this.icon.label.text = this.app.get_generic_name();
+ this.icon.update();
+ }
+
+ _setHoveringByDnd(hovering) {
+ this._hovering = hovering;
+
+ this.icon.update();
+ }
+
+ _createIcon(iconSize) {
+ if (!this._dragMonitor)
+ return super._createIcon(iconSize);
+
+ let iconResource = '';
+ if (this._hovering)
+ iconResource = 'resource:///org/gnome/shell/theme/trash-icon-full.png';
+ else
+ iconResource = 'resource:///org/gnome/shell/theme/trash-icon-empty.png';
+
+ let gicon = new Gio.FileIcon({
+ file: Gio.File.new_for_uri(iconResource),
+ });
+
+ return new St.Icon({
+ gicon: gicon,
+ icon_size: iconSize,
+ });
+ }
+
+ _canAccept(source) {
+ return source instanceof ViewIcon;
+ }
+
+ acceptDrop(source) {
+ this._setHoveringByDnd(false);
+
+ if (!this._canAccept(source))
+ return false;
+
+ const iconGridLayout = IconGridLayout.getDefault();
+ iconGridLayout.removeIcon(source.id, true);
+ return true;
+ }
+});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]