appDisplay: Rename popup API to dialog
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/896
This commit is contained in:
parent
53c12dc33e
commit
7781f973f2
@ -365,19 +365,19 @@ var AllView = GObject.registerClass({
|
|||||||
|
|
||||||
this._clickAction = new Clutter.ClickAction();
|
this._clickAction = new Clutter.ClickAction();
|
||||||
this._clickAction.connect('clicked', () => {
|
this._clickAction.connect('clicked', () => {
|
||||||
if (!this._currentPopup)
|
if (!this._currentDialog)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let [x, y] = this._clickAction.get_coords();
|
let [x, y] = this._clickAction.get_coords();
|
||||||
let actor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
|
let actor = global.stage.get_actor_at_pos(Clutter.PickMode.ALL, x, y);
|
||||||
if (!this._currentPopup.contains(actor))
|
if (!this._currentDialog.contains(actor))
|
||||||
this._currentPopup.popdown();
|
this._currentDialog.popdown();
|
||||||
});
|
});
|
||||||
this._eventBlocker.add_action(this._clickAction);
|
this._eventBlocker.add_action(this._clickAction);
|
||||||
|
|
||||||
this._currentPopup = null;
|
this._currentDialog = null;
|
||||||
this._displayingPopup = false;
|
this._displayingDialog = false;
|
||||||
this._currentPopupDestroyId = 0;
|
this._currentDialogDestroyId = 0;
|
||||||
|
|
||||||
this._canScroll = true; // limiting scrolling speed
|
this._canScroll = true; // limiting scrolling speed
|
||||||
this._scrollTimeoutId = 0;
|
this._scrollTimeoutId = 0;
|
||||||
@ -397,7 +397,7 @@ var AllView = GObject.registerClass({
|
|||||||
this.emit('space-ready');
|
this.emit('space-ready');
|
||||||
});
|
});
|
||||||
this._grid.connect('space-closed', () => {
|
this._grid.connect('space-closed', () => {
|
||||||
this._displayingPopup = false;
|
this._displayingDialog = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
this._redisplayWorkId = Main.initializeDeferredWork(this, this._redisplay.bind(this));
|
this._redisplayWorkId = Main.initializeDeferredWork(this, this._redisplay.bind(this));
|
||||||
@ -548,8 +548,8 @@ var AllView = GObject.registerClass({
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (animationDirection == IconGrid.AnimationDirection.OUT &&
|
if (animationDirection == IconGrid.AnimationDirection.OUT &&
|
||||||
this._displayingPopup && this._currentPopup) {
|
this._displayingDialog && this._currentDialog) {
|
||||||
this._currentPopup.popdown();
|
this._currentDialog.popdown();
|
||||||
let spaceClosedId = this._grid.connect('space-closed', () => {
|
let spaceClosedId = this._grid.connect('space-closed', () => {
|
||||||
this._grid.disconnect(spaceClosedId);
|
this._grid.disconnect(spaceClosedId);
|
||||||
super.animate(animationDirection, completionFunc);
|
super.animate(animationDirection, completionFunc);
|
||||||
@ -564,9 +564,9 @@ var AllView = GObject.registerClass({
|
|||||||
animateSwitch(animationDirection) {
|
animateSwitch(animationDirection) {
|
||||||
super.animateSwitch(animationDirection);
|
super.animateSwitch(animationDirection);
|
||||||
|
|
||||||
if (this._currentPopup && this._displayingPopup &&
|
if (this._currentDialog && this._displayingDialog &&
|
||||||
animationDirection == IconGrid.AnimationDirection.OUT) {
|
animationDirection == IconGrid.AnimationDirection.OUT) {
|
||||||
this._currentPopup.ease({
|
this._currentDialog.ease({
|
||||||
opacity: 0,
|
opacity: 0,
|
||||||
duration: VIEWS_SWITCH_TIME,
|
duration: VIEWS_SWITCH_TIME,
|
||||||
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
mode: Clutter.AnimationMode.EASE_OUT_QUAD,
|
||||||
@ -585,10 +585,12 @@ var AllView = GObject.registerClass({
|
|||||||
goToPage(pageNumber, animate = true) {
|
goToPage(pageNumber, animate = true) {
|
||||||
pageNumber = clamp(pageNumber, 0, this._grid.nPages() - 1);
|
pageNumber = clamp(pageNumber, 0, this._grid.nPages() - 1);
|
||||||
|
|
||||||
if (this._grid.currentPage == pageNumber && this._displayingPopup && this._currentPopup)
|
if (this._grid.currentPage === pageNumber &&
|
||||||
|
this._displayingDialog &&
|
||||||
|
this._currentDialog)
|
||||||
return;
|
return;
|
||||||
if (this._displayingPopup && this._currentPopup)
|
if (this._displayingDialog && this._currentDialog)
|
||||||
this._currentPopup.popdown();
|
this._currentDialog.popdown();
|
||||||
|
|
||||||
if (!this.mapped) {
|
if (!this.mapped) {
|
||||||
this._adjustment.value = this._grid.getPageY(pageNumber);
|
this._adjustment.value = this._grid.getPageY(pageNumber);
|
||||||
@ -611,7 +613,7 @@ var AllView = GObject.registerClass({
|
|||||||
|
|
||||||
openSpaceForPopup(item, side, nRows) {
|
openSpaceForPopup(item, side, nRows) {
|
||||||
this._updateIconOpacities(true);
|
this._updateIconOpacities(true);
|
||||||
this._displayingPopup = true;
|
this._displayingDialog = true;
|
||||||
this._grid.openExtraSpace(item, side, nRows);
|
this._grid.openExtraSpace(item, side, nRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -626,7 +628,7 @@ var AllView = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_onScroll(actor, event) {
|
_onScroll(actor, event) {
|
||||||
if (this._displayingPopup || !this._scrollView.reactive)
|
if (this._displayingDialog || !this._scrollView.reactive)
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
|
|
||||||
if (this._swipeTracker.canHandleScrollEvent(event))
|
if (this._swipeTracker.canHandleScrollEvent(event))
|
||||||
@ -688,7 +690,7 @@ var AllView = GObject.registerClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
_onKeyPressEvent(actor, event) {
|
_onKeyPressEvent(actor, event) {
|
||||||
if (this._displayingPopup)
|
if (this._displayingDialog)
|
||||||
return Clutter.EVENT_STOP;
|
return Clutter.EVENT_STOP;
|
||||||
|
|
||||||
if (event.get_key_symbol() === Clutter.KEY_Page_Up) {
|
if (event.get_key_symbol() === Clutter.KEY_Page_Up) {
|
||||||
@ -702,23 +704,23 @@ var AllView = GObject.registerClass({
|
|||||||
return Clutter.EVENT_PROPAGATE;
|
return Clutter.EVENT_PROPAGATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
addFolderPopup(popup) {
|
addFolderDialog(dialog) {
|
||||||
this.add_child(popup);
|
this.add_child(dialog);
|
||||||
popup.connect('open-state-changed', (o, isOpen) => {
|
dialog.connect('open-state-changed', (o, isOpen) => {
|
||||||
this._eventBlocker.visible = isOpen;
|
this._eventBlocker.visible = isOpen;
|
||||||
|
|
||||||
if (this._currentPopup) {
|
if (this._currentDialog) {
|
||||||
this._currentPopup.disconnect(this._currentPopupDestroyId);
|
this._currentDialog.disconnect(this._currentDialogDestroyId);
|
||||||
this._currentPopupDestroyId = 0;
|
this._currentDialogDestroyId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._currentPopup = null;
|
this._currentDialog = null;
|
||||||
|
|
||||||
if (isOpen) {
|
if (isOpen) {
|
||||||
this._currentPopup = popup;
|
this._currentDialog = dialog;
|
||||||
this._currentPopupDestroyId = popup.connect('destroy', () => {
|
this._currentDialogDestroyId = dialog.connect('destroy', () => {
|
||||||
this._currentPopup = null;
|
this._currentDialog = null;
|
||||||
this._currentPopupDestroyId = 0;
|
this._currentDialogDestroyId = 0;
|
||||||
this._eventBlocker.visible = false;
|
this._eventBlocker.visible = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -872,7 +874,7 @@ var AllView = GObject.registerClass({
|
|||||||
this._dragMonitor = null;
|
this._dragMonitor = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._eventBlocker.visible = this._currentPopup !== null;
|
this._eventBlocker.visible = this._currentDialog !== null;
|
||||||
this._resetOvershoot();
|
this._resetOvershoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -901,8 +903,8 @@ var AllView = GObject.registerClass({
|
|||||||
let view = _getViewFromIcon(source);
|
let view = _getViewFromIcon(source);
|
||||||
view.removeApp(source.app);
|
view.removeApp(source.app);
|
||||||
|
|
||||||
if (this._currentPopup)
|
if (this._currentDialog)
|
||||||
this._currentPopup.popdown();
|
this._currentDialog.popdown();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1538,7 +1540,7 @@ var FolderIcon = GObject.registerClass({
|
|||||||
path });
|
path });
|
||||||
this._delegate = this;
|
this._delegate = this;
|
||||||
// whether we need to update arrow side, position etc.
|
// whether we need to update arrow side, position etc.
|
||||||
this._popupInvalidated = false;
|
this._dialogInvalidated = false;
|
||||||
|
|
||||||
this.icon = new IconGrid.BaseIcon('', {
|
this.icon = new IconGrid.BaseIcon('', {
|
||||||
createIcon: this._createIcon.bind(this),
|
createIcon: this._createIcon.bind(this),
|
||||||
@ -1575,8 +1577,8 @@ var FolderIcon = GObject.registerClass({
|
|||||||
this._spaceReadySignalId = 0;
|
this._spaceReadySignalId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._popup)
|
if (this._dialog)
|
||||||
this._popup.destroy();
|
this._dialog.destroy();
|
||||||
|
|
||||||
this._removeMenuTimeout();
|
this._removeMenuTimeout();
|
||||||
}
|
}
|
||||||
@ -1588,15 +1590,15 @@ var FolderIcon = GObject.registerClass({
|
|||||||
vfunc_unmap() {
|
vfunc_unmap() {
|
||||||
super.vfunc_unmap();
|
super.vfunc_unmap();
|
||||||
|
|
||||||
if (this._popup)
|
if (this._dialog)
|
||||||
this._popup.popdown();
|
this._dialog.popdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
open() {
|
open() {
|
||||||
this._removeMenuTimeout();
|
this._removeMenuTimeout();
|
||||||
this._ensurePopup();
|
this._ensureFolderDialog();
|
||||||
this.view._scrollView.vscroll.adjustment.value = 0;
|
this.view._scrollView.vscroll.adjustment.value = 0;
|
||||||
this._popup.popup();
|
this._dialog.popup();
|
||||||
}
|
}
|
||||||
|
|
||||||
getAppIds() {
|
getAppIds() {
|
||||||
@ -1695,18 +1697,18 @@ var FolderIcon = GObject.registerClass({
|
|||||||
return usedHeight;
|
return usedHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
_ensurePopup() {
|
_ensureFolderDialog() {
|
||||||
if (this._popup && !this._popupInvalidated)
|
if (this._dialog && !this._dialogInvalidated)
|
||||||
return;
|
return;
|
||||||
if (!this._popup) {
|
if (!this._dialog) {
|
||||||
this._popup = new AppFolderPopup(this);
|
this._dialog = new AppFolderDialog(this);
|
||||||
this._parentView.addFolderPopup(this._popup);
|
this._parentView.addFolderDialog(this._dialog);
|
||||||
this._popup.connect('open-state-changed', (popup, isOpen) => {
|
this._dialog.connect('open-state-changed', (popup, isOpen) => {
|
||||||
if (!isOpen)
|
if (!isOpen)
|
||||||
this.checked = false;
|
this.checked = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this._popupInvalidated = false;
|
this._dialogInvalidated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_removeMenuTimeout() {
|
_removeMenuTimeout() {
|
||||||
@ -1785,9 +1787,9 @@ var FolderIcon = GObject.registerClass({
|
|||||||
adaptToSize(width, height) {
|
adaptToSize(width, height) {
|
||||||
this._parentAvailableWidth = width;
|
this._parentAvailableWidth = width;
|
||||||
this._parentAvailableHeight = height;
|
this._parentAvailableHeight = height;
|
||||||
if (this._popup)
|
if (this._dialog)
|
||||||
this.view.adaptToSize(width, height);
|
this.view.adaptToSize(width, height);
|
||||||
this._popupInvalidated = true;
|
this._dialogInvalidated = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1891,11 +1893,11 @@ var RenameFolderMenu = class RenameFolderMenu extends PopupMenu.PopupMenu {
|
|||||||
};
|
};
|
||||||
Signals.addSignalMethods(RenameFolderMenu.prototype);
|
Signals.addSignalMethods(RenameFolderMenu.prototype);
|
||||||
|
|
||||||
var AppFolderPopup = GObject.registerClass({
|
var AppFolderDialog = GObject.registerClass({
|
||||||
Signals: {
|
Signals: {
|
||||||
'open-state-changed': { param_types: [GObject.TYPE_BOOLEAN] },
|
'open-state-changed': { param_types: [GObject.TYPE_BOOLEAN] },
|
||||||
},
|
},
|
||||||
}, class AppFolderPopup extends St.Widget {
|
}, class AppFolderDialog extends St.Widget {
|
||||||
_init(source) {
|
_init(source) {
|
||||||
super._init({
|
super._init({
|
||||||
layout_manager: new Clutter.BinLayout(),
|
layout_manager: new Clutter.BinLayout(),
|
||||||
|
Loading…
Reference in New Issue
Block a user