[gnome-shell/gbsneto/icon-grid-dnd: 40/43] appIcon: Show folder preview when dragging over
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/icon-grid-dnd: 40/43] appIcon: Show folder preview when dragging over
- Date: Fri, 2 Aug 2019 19:36:31 +0000 (UTC)
commit 40ad9ab18c6bfc054c902222c62a90986a093725
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Fri Jul 12 19:32:54 2019 -0300
appIcon: Show folder preview when dragging over
WIP
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/603
js/ui/appDisplay.js | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 57 insertions(+)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 6a722498b..cf71d7b10 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -2063,6 +2063,7 @@ var AppIcon = class AppIcon extends BaseViewIcon {
this.actor._delegate = this;
this._scaleInId = 0;
+ this._folderPreviewId = 0;
delete iconParams['isDraggable'];
@@ -2095,6 +2096,11 @@ var AppIcon = class AppIcon extends BaseViewIcon {
_onDestroy() {
super._onDestroy();
+ if (this._folderPreviewId > 0) {
+ GLib.source_remove(this._folderPreviewId);
+ this._folderPreviewId = 0;
+ }
+
if (this._stateChangedId > 0)
this.app.disconnect(this._stateChangedId);
this._stateChangedId = 0;
@@ -2249,6 +2255,57 @@ var AppIcon = class AppIcon extends BaseViewIcon {
shouldShowTooltip() {
return this.actor.hover && (!this._menu || !this._menu.isOpen);
}
+
+ _showFolderPreview() {
+ this.icon.label.opacity = 0;
+
+ // HACK!!!
+ this.icon._iconBin.save_easing_state();
+ this.icon._iconBin.scale_x = FOLDER_SUBICON_FRACTION;
+ this.icon._iconBin.scale_y = FOLDER_SUBICON_FRACTION;
+ this.icon._iconBin.restore_easing_state();
+ }
+
+ _hideFolderPreview() {
+ this.icon.label.opacity = 255;
+
+ // HACK!!!
+ this.icon._iconBin.save_easing_state();
+ this.icon._iconBin.scale_x = 1.0;
+ this.icon._iconBin.scale_y = 1.0;
+ this.icon._iconBin.restore_easing_state();
+ }
+
+ _setHoveringByDnd(hovering) {
+ if (hovering) {
+ if (this._folderPreviewId > 0)
+ return;
+
+ this._folderPreviewId =
+ GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, () => {
+ this._folderPreviewId = 0;
+
+ super._setHoveringByDnd(true);
+ this._showFolderPreview();
+
+ return GLib.SOURCE_REMOVE;
+ });
+ } else {
+ if (this._folderPreviewId > 0) {
+ GLib.source_remove(this._folderPreviewId);
+ this._folderPreviewId = 0;
+ }
+
+ super._setHoveringByDnd(false);
+ this._hideFolderPreview();
+ }
+ }
+
+ _canDropAt(source) {
+ return source != this &&
+ (source instanceof AppIcon) &&
+ (this.view instanceof AllView);
+ }
};
Signals.addSignalMethods(AppIcon.prototype);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]