[gnome-shell/gbsneto/icon-grid-dnd: 95/96] 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: 95/96] appIcon: Show folder preview when dragging over
- Date: Tue, 16 Jul 2019 23:30:07 +0000 (UTC)
commit 5d5e645e11a851532cd9a46e3a93de3d52f6ef58
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 | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index ff0d077ba..53c7e2cb7 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -2067,6 +2067,7 @@ var AppIcon = class AppIcon extends BaseViewIcon {
this.actor._delegate = this;
this._scaleInId = 0;
+ this._folderPreviewId = 0;
delete iconParams['isDraggable'];
delete iconParams['isDropTarget'];
@@ -2101,6 +2102,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;
@@ -2259,6 +2265,56 @@ var AppIcon = class AppIcon extends BaseViewIcon {
get parentView() {
return this._parentView;
}
+
+ _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, 750, () => {
+ 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 instanceof AppIcon) &&
+ (this._parentView instanceof AllView);
+ }
};
Signals.addSignalMethods(AppIcon.prototype);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]